0 0 Votes

CSS: Break long words if container is not big enough

Question by Guest | 30/01/2014 at 19:05

I have a DIV-container in my CSS-layout in which some very long words can appear from time to time (for example a long link).

I would like to force the behavior that long words are wrapped into the next line at the end of the box, because it looks very ugly when words are protruding beyond their area overlapping the other content of my website next to the corresponding text box.

In the Internet, I have read, that there is no possibility to code a hyphenation using CSS. Nevertheless, are there any possibilities to realize this line break?

ReplyPositiveNegative

Stefan Trost

Show Profile | Message
Avatar
0Best Answer
0 Votes

Just try the CSS property "word-wrap":

word-wrap: break-word;

When setting "word-wrap" to "break-word" for the corresponding area, the result should exactly be the behavior, you have described.

The property "word-wrap" can take two different values. The default value is "normal". With this, words are only wrapped at the common break points such as line breaks. The value "break-word" also allows breaking within a word.
31/01/2014 at 13:06

ReplyPositive Negative
Reply

Related Topics

Scrollbar in DIV container
Question | 1 Answer

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own articles on askingbox.com. How to do.