-1

My text in HTML goes vertically horizontally

should have been like this :

it went like this

THIS one above is my code written in text This one is his

    `
<html> 
    <head>
        <style>
            #box{
                width: 250px;
                height: 250px;
                border: 2px solid black;   
               
            }
        </style>
    </head>
    <body>

        <h1>CSS overflow</h1>

        <div id="box">
            aldskf;jjjjjjjjjjjjjjjjjjjjjjjjjjdaslk;jlaksjdfaslkdjfaslkjlkjlkjkljlk;;sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssfjkaldslgrjlgfjlkgjslkjfsdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddglkjgrrrrrrrrrrrrrrrrrrrrrrrrrrra;oi      
        </div>

    </body>
</html>
  • Use realistic text in your test code (i.e. text with words and spaces between them), then your problem will disappear... – Johannes Sep 06 '20 at 13:30

2 Answers2

1

Because his example is seperating the words, they will automatically break to a new line when it needs to, since you just have a string of characters you will need to tell the css to break automatically

Add overflow-wrap: break-word to your css here's what it looks like for me

Revan
  • 36
  • 2
  • 3
0

You can use word-wrap: break-word

#box{
   word-wrap: break-word
 }
Friday Ameh
  • 1,664
  • 1
  • 10
  • 15