Home > Article > Web Front-end > css automatic line wrapping
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;}