Home  >  Article  >  Web Front-end  >  css automatic line wrapping

css automatic line wrapping

高洛峰
高洛峰Original
2016-10-19 10:16:051694browse

Method 1: First fix the width of the table, that is, give the table a width value (numeric value, not percentage)

Method 2: Force no line wrapping

 div{//white-space: no line wrapping; normal default; nowrap Force all text to be displayed in the same line until the end of the text or encounter br object white-space:nowrap; }

Method 3: Automatic line wrapping

 div{ word-wrap: break-word; //word-break Set forced line breaks; normal text rules for Asian and non-Asian languages, allowing line breaks within words word-break: normal; }

Method 4: Force English word line breaks

 div{word-break:break- all;}

Note:

Define the following sentence in CSS to prevent the web page from being "stretched":

 table{table-layout: fixed;}td(word-break: break -all; word-wrap:break-word;)

Prevent the table/layer from being "stretched", while ensuring that a single English word will not be split when breaking lines:

 table { table-layout: fixed ;word-wrap:break-word;}

 div { word-wrap:break-word;}


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