CSS Web page when the implementation of automatic line wrapping tips

Source: Internet
Author: User
Keywords Web page production CSS Tutorials
Tags automatic based browser class content continuous digital firefox browser

CSS Web page when the implementation of the tips for automatic wrapping March 06, 2009 10:47 Everyone knows that the continuous English or digital can be the container is propped up, can not be based on the size of the container line, the following is how the CSS will be their line-wrapping Method!


for Div 1. (ie browser) white-space:normal; Word-break:break-all, where the former is to follow the standard. #wrap {white-space:normal; width:200px;}


or
.

#wrap {word-break:break-all;width:200px} Eg.<div id= "wrap" >ddd1111111111111111111111111111111111</div> effect: can implement Line 2. (Firefox browser) White-space: Normal; Word-break:break-all;overflow:hidden, the same FF also does not have a good implementation method, can only hide or add scroll bar, of course, no scroll bar effect better! #wrap {white-space:normal; width:200px; overflow:auto;}


or
.

#wrap {word-break:break-all;width:200px; Overflow:auto} Eg.<div id= "wrap" >ddd1111111111111111111111111111111111111111</div> effect: container normal, content hidden for table 1. (ie browser) use style table-layout:fixed;


eg.<style>


. tb{table-layout:fixed}


</style><table class= "tbl" width= ">
"

<tr>


<TD>ABCDEFGHIGKLMNOPQRSTUVWXYZ 1234567890


</td>


</tr>


</table> Effect: You can change line 2. (ie browser) using styles table-layout:fixed and nowrapeg.<style>


. TB {table-layout:fixed}


</style><table class= "TB" width= >


<tr>


<td nowrap>abcdefghigklmnopqrstuvwxyz 1234567890


</td>


</tr>


</table> Effect: You can change line 3. (ie browser) using a percentage fixed TD size with a style table-layout:fixed and nowrap<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: Two TD are normal Exchange line 3. (Firefox browser) uses the style table-layout:fixed with nowrap when using percent fixed TD size, and uses diveg.<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 as a percentage

Effect: normal display, but can not wrap (note: Under FF has not been able to make the container content of a good way, can only use overflow will be more out of the content to hide, so as not to affect the overall effect)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.