CSS Auto-wrap-designer 0 sheets

Source: Internet
Author: User

Automatic line-wrapping problem, normal character line is more reasonable, and continuous digital and English characters are often the container braces, it is a headache, the following is how CSS implementation of the method of line wrapping

for block-level elements such as Div,p
Line wrapping for normal text (Asian and non-Asian text) elements have default white-space:normal, and wrap after defined width
Html
<div id= "Wrap" > Normal text wrap (Asian and non-Asian) elements have the default white-space:normal when defined </div>
Css
#wrap {white-space:normal; width:200px;}

1. (IE) consecutive English characters and Arabic numerals, using Word-wrap:break-word; or word-break:break-all; implement force break

#wrap {word-break:break-all; width:200px;}
Or
#wrap {word-wrap:break-word; width:200px;}

<div id= "Wrap" >abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div>

Effect: line wrapping can be implemented

2. (Firefox browser) consecutive lines of English characters and Arabic numerals, all versions of Firefox do not solve this problem, we only let the characters beyond the boundary hide or add a scrollbar to the container

#wrap {word-break:break-all; width:200px; overflow:auto;}

<div id= "Wrap" >abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div>

Effect: Container normal, content hidden

for Table

1. (IE) use table-layout:fixed; Force table width, excess content hidden

<table style= "table-layout:fixed" width= ">"
<tr>
<td>abcdefghigklmnopqrstuvwxyz1234567890ssssssssssssss
</td>
</tr>
</table>

Effect: Hide Excess content

2. (IE) use table-layout:fixed, force the width of table, inner layer td,th adopt word-break:break-all; or Word-wrap:break-word; line break

<table width= "" "style=" table-layout:fixed; " >
<tr>
<TD width= "25%" style= "Word-break:break-all; ">abcdefghigklmnopqrstuvwxyz 1234567890
</td>
<TD style= "Word-wrap:break-word;" >ABCDEFGHIGKLMNOPQRSTUVWXYZ 1234567890
</td>
</tr>
</table>

Effect: can be changed line

3. (IE) nested div,p in td,th, etc. using the div,p of the above mentioned line-wrapping method

4. (Firefox browser) use table-layout:fixed, force table width, inner layer td,th adopt word-break:break-all; or Word-wrap:break-word; line break, Use Overflow:hidden; hide beyond content, here Overflow:auto; not working

<table style= "table-layout:fixed" width= ">"
<tr>
<TD width= "25%" style= "Word-break:break-all; Overflow:hidden; ">abcdefghigklmnopqrstuvwxyz1234567890</td>
<TD width= "75%" style= "Word-wrap:break-word; Overflow:hidden; ">abcdefghigklmnopqrstuvwxyz1234567890</td>
</tr>
</table>

Effect: Hide more than content

5. (Firefox browser) in td,th nested div,p, etc. using the above mentioned method of dealing with Firefox
Run the Code box
Finally, the probability of this phenomenon is very small, but can not rule out the user's spoof. If you have any questions, please go to my message book.

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.