Continuous English in CSS cannot be wrapped automatically.

Source: Internet
Author: User
We often see in the page, such as Web site can not be broken automatically (as shown below)
If it is a Chinese character, you can wrap the line automatically. If it is a continuous English or number will be regarded as a word, even if the maximum width will not automatically break, but directly to the next line.
So here you can use Word-break:break-all to achieve a long English automatic break (the effect of the following figure).

Such as

The code is as follows Copy Code
: <p style= "Word-break:break-all;" ></p>

Finally, summarize

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

The code is as follows Copy Code

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

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

Effect: You can implement line wrapping

2. (Firefox browser) consecutive English characters and Arabic numerals break, all versions of Firefox did not solve this problem, we have to let go beyond the bounds of the characters hidden or, add a scroll bar to the container

The code is as follows Copy Code


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

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

Effect: Container normal, content hidden

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.