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

How to use text-wrap attribute

青灯夜游
青灯夜游Original
2019-02-11 15:28:303537browse

The text-wrap attribute is used to specify text wrapping rules; when the value is normal, it means that the line is wrapped only at the allowed line break point, the value of none means that the line is not wrapped, and the value of unrestricted means that the line is wrapped between any two characters. For suppress, it means that the line will be broken only when there are no other valid line breaks in the line.

How to use text-wrap attribute

CSS3 text-wrap attribute

Function:text-wrap attribute Specifies line wrapping (wrap) rules for text.

Syntax:

text-wrap: normal|none|unrestricted|suppress;

normal: Line breaks only at allowed line breaks.​

none: No line breaks. Text that the element cannot fit will overflow.

unrestricted: Line break between any two characters.​

suppress: Line breaks in compressed elements. Browsers only wrap lines if there are no other valid break points in the line.

Note: Currently mainstream browsers do not support the text-wrap attribute.

CSS3 text-wrap attribute usage example

<!DOCTYPE html>
<html>
<head>
<style> 
p.test1
{
width:11em; 
border:1px solid #000000;
text-wrap:none;
}
p.test2
{
width:11em; 
border:1px solid #000000;
text-wrap:normal;
}
</style>
</head>
<body>
<p class="test1">这段包含一些文本。这一行的文字不会换行到下一行。</p>
<p class="test2"> 这段包含一些文本。这一行的文字正常换行。.</p>
</body>
</html>

The above is the detailed content of How to use text-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