Home >Web Front-end >CSS Tutorial >How to implement CSS to automatically wrap content in web pages
Numbers can make the container expand and cannot wrap automatically according to the size of the container. Here is how to wrap them with CSS!
For div
1. (IE browser) white-space:normal; word-break:break-all; The former here follows the standard. #Wrap {White-SPACE: NORMAL; Width: 200px;}
or#wrap {Word-Bream: Bream-ALL; width: 200px;}
& lt; div id = "wrap" & gt; 111111111111111111111111111111 & lt;/ div>
Effect: Line breaks can be achieved
2. (Firefox browser) white-space:normal; word-break:break-all;overflow:hidden; There is no good implementation method under the same FF, only Hide or add scroll bars, of course the effect is better without adding scroll bars!
#wrap{white-space:normal; width:200px; overflow:auto;}
or#wrap{word-break:break-all;width:200px; overflow:auto; }
Effect: The container is normal and the content is hidden
For table
1. (IE browser) use the style table-layout:fixed;
abcdefghigklmnopqrstuvwxyz 1234567890 |
2. (IE browser) Use the style table-layout: fixed and nowrap
.tb {table-layout:fixed}
abcdefghigklmnopqrstuvwxyz 1234567890 |
abcdefghigklmnopqrstuvwxyz 1234567890 | abcdefghigklmnopqrstuvwxyz 1234567890 |
4. (Firefox browser) Use style table when using percentage to fix td size -layout:fixed and nowrap, and use div
.tb {table-layout:fixed}.td {overflow:hidden;}
abcdefghigklmnopqrstuvwxyz 1234567890 | < div>abcdefghigklmnopqrstuvwxyz 1234567890 There is no good way to wrap container content under FF. You can only use overflow to hide the extra content so as not to affect the overall effect) |