I have the following code:
.thing {
width: 90%;
height: 400px;
border: 10px solid #000;
}
<div class="thing">
aaaaaaaaaaaa
</div>
The problem is that when I add to much content, the text goes out of the div!
How to fix this using only CSS?
You can insert line breaks in HTML with the <br> tag, which is equivalent to a carriage return on a keyboard.
Press ALT+ENTER to insert the line break.
To do a line break in HTML, use the <br> tag. Simply place the tag wherever you want to force a line break. Since an HTML line break is an empty element, there's no closing tag.
A line-break can be added in HTML, using only CSS, by employing the pseudo-class ::after or ::before . In the stylesheet, we use these pseudo-classes, with the HTML class or id, before or after the place where we want to insert a line-break. In myClass::after : Set the content property to "\a" (the new-line character).
.thing {
width: 90%;
height: 400px;
padding: 10px solid #000;
word-break:break-all;
}
use word-break
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With