How to use css word-wrap attribute

青灯夜游
Release: 2022-05-27 16:38:14
Original
5903 people have browsed it

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;
Copy after login

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>
Copy after login

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!

Related labels:
css
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template