css word-wrap attribute is used to set the line break method when the element content exceeds the boundary of its container. It is often set to automatically wrap long words or URL addresses at the boundary of the container; the syntax "word-wrap:normal|break -word;", when the attribute value is "word-wrap", automatic line wrapping is implemented.
How to use the css word-wrap attribute?
The word-wrap attribute allows long content to be automatically wrapped. It sets or retrieves whether words are broken when the content exceeds the bounds of its container.
Syntax
word-wrap: normal|break-word;
Attribute value:
● Normal: Line breaks only at allowed hyphenation points (the browser keeps handled by default).
● Break-word: Line break inside long words or URL addresses.
Note: All major browsers support the word-wrap attribute.
css word-wrap attribute example
<!DOCTYPE html> <html> <head> <style> p{ width:11em; border:1px solid #000000; } p.test{ word-wrap:break-word; } </style> </head> <body> <p>dsffdgrh121324gfdgfhhgjhkkjlkl;</p> <p class="test">dsffdgrh121324gfdgfhhgjhkkjlkl;</p> </body> </html>
Rendering:
The above is the detailed content of How to use css word-wrap attribute. For more information, please follow other related articles on the PHP Chinese website!