Home  >  Article  >  Web Front-end  >  How to use css text-wrap attribute

How to use css text-wrap attribute

藏色散人
藏色散人Original
2019-05-30 09:40:513323browse

css The text-wrap attribute is used to specify line wrapping (line wrapping) rules for text. Its syntax is text-wrap: normal|none|unrestricted|suppress; currently, mainstream browsers do not support the text-wrap attribute.

How to use css text-wrap attribute

How to use the css text-wrap attribute?

Function: The text-wrap attribute specifies the line wrapping (line wrapping) rules of text.

Syntax:

text-wrap: normal|none|unrestricted|suppress

Description:

normal Only perform line breaks at allowed line break points.​

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

unrestricted ​ Break a new line between any two characters.​

suppress ​ Compress line breaks in 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.

css 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"> This paragraph contains some text. This line should not breake or wrap to the next line.</p>
<p class="test2"> This paragraph contains some text: The line breaks as normal.</p>
<p><b>注释:</b>目前主流浏览器都不支持 text-wrap 属性。</p>
</body>
</html>

Effect output:

How to use css text-wrap attribute

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