Home >Web Front-end >CSS Tutorial >How to use css word-wrap attribute

How to use css word-wrap attribute

青灯夜游
青灯夜游Original
2019-05-28 18:05:475957browse

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 css word-wrap attribute

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:

How to use css word-wrap attribute

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn