We all know that continuous English or numbers can be large containers and cannot be automatically wrapped according to the container size. below is how CSS wrap them!
For div
1. (IE browser) white-space: normal; word-break: break-all; the former follows the standard.
# Wrap {white-space: normal; width: 200px ;}
Or
# Wrap {word-break: break-all; width: 200px ;}
<Div id = "wrap"> ddd111111111111111111111111111111111111111111 </div>
Effect: line breaks can be implemented.
2. (Firefox) white-space: normal; word-break: break-all; overflow: hidden; the same FF does not have a good implementation method. You can only hide or add a scroll bar, of course, it is better to not add a scroll bar!
# Wrap {white-space: normal; width: 200px; overflow: auto ;}
Or
# Wrap {word-break: break-all; width: 200px; overflow: auto ;}
<Div id = "wrap"> ddd11111111111111111111111111111111111111111111 </div>
Effect: the container is normal and the content is hidden.
For table
1. (IE browser) use the style table-layout: fixed;
<Style>
. Tb {table-layout: fixed}
</Style>
<Table class = "tbl" width = "80">
<Tr>
<Td> abcdefghigklmnopqrstuvwxyz 1234567890
</Td>
</Tr>
</Table>
Effect: line breaks are supported.
2. (IE browser) use the style table-layout: fixed and nowrap
<Style>
. Tb {table-layout: fixed}
</Style>
<Table class = "tb" width = "80">
<Tr>
<Td nowrap> abcdefghigklmnopqrstuvwxyz 1234567890
</Td>
</Tr>
</Table>
Effect: line breaks are supported.
3. (IE browser) use the style table-layout: fixed and nowrap when the percentage is fixed to the td size.
<Style>
. Tb {table-layout: fixed}
</Style>
<Table class = "tb" width = 80>
<Tr>
<Td width = 25% nowrap> abcdefghigklmnopqrstuvwxyz 1234567890
</Td>
<Td nowrap> abcdefghigklmnopqrstuvwxyz 1234567890
</Td>
</Tr>
</Table>
Effect: The line feed is normal for both td devices.
3. (Firefox) use the style table-layout: fixed and nowrap when the percentage is fixed to the td size, and use the div
<Style>
. Tb {table-layout: fixed}
. Td {overflow: hidden ;}
</Style>
<Table class = tb width = 80>
<Tr>
<Td width = 25% class = td nowrap>
<Div> abcdefghigklmnopqrstuvwxyz 1234567890 </div>
</Td>
<Td class = td nowrap>
<Div> abcdefghigklmnopqrstuvwxyz 1234567890 </div>
</Td>
</Tr>
</Table>
The cell width must be defined in percentage.
Effect: normal display, but not line feed (Note: There is no good way to wrap the container content under FF, you can only use overflow to hide the extra content to avoid affecting the overall effect)