I declared width
and margins
but somehow my lines didn't get wrapped with an automatic line-break.
edit: I found the cause. It's because there are no spaces between words:
teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest teest
Basic HTML Line Break Syntax You can insert line breaks in HTML with the <br> tag, which is equivalent to a carriage return on a keyboard. Be aware that HTML will ignore any line break from a keyboard's return key.
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.
To add spacing between lines or paragraphs of text in a cell, use a keyboard shortcut to add a new line. Click the location where you want to break the line. Press ALT+ENTER to insert the line break.
The <nobr> HTML element prevents the text it contains from automatically wrapping across multiple lines, potentially resulting in the user having to scroll horizontally to see the entire width of the text.
The element where text is should have css declaration:
div {
display: block;
width: 200px; /*based on how much width this div should have*/
}
and if it doesn't work try doing:
div { word-wrap: break-word }
try this one by one, it must be helpful for some situation:
p{
display: block; /* or inline-block, at least its a block element */
width: 100px; /* or width is certain by parent element */
height: auto; /* height cannot be defined */
word-break: break-all; /* */
word-wrap: break-word; /* if you want to cut the complete word */
white-space: normal; /* be sure its not 'nowrap'! ! ! :/ */
}
another way to do it is by:
white-space: pre-wrap; // preserve whitespace, the text is wrapped
overflow-wrap: break-word; // text is wrapped, line break on the end of a word
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