CSS: Break long words if container is not big enough
Question by Guest | 2014-01-30 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?
Related Topics
CSS: Include CSS Stylesheets in HTML
Tutorial | 0 Comments
Website Performance: Deliver JavaScript and CSS files compressed to reduce loading times
Tutorial | 0 Comments
jQuery: CSS Stylesheet Switcher
Tutorial | 1 Comment
Rewrite Text Files with a fixed Line Length
Tutorial | 0 Comments
Reload Images, CSS, JS and Web Pages despite Browser Cache
Tip | 2 Comments
Repair Text Files with mixed Line Breaks
Tutorial | 0 Comments
Darken Background of a Website (Gray Out Effect)
Tutorial | 0 Comments
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 article on askingbox.com. That’s how it’s done.
Just try the CSS property "word-wrap":
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.
2014-01-31 at 13:06