Some questions about character wrapping in CSS

Source: Internet
Author: User
CSS in Word-break can solve this problem, write a test page to make a note

CSS code:

body{font-size:14px;} p{border:solid 1px red;width:200px;}   <body>    <p class= "Test" > Chinese Chinowen englis333henglishenglishenglish Chinese, Chinese, Chinese Chinoven Chinoven Chinoven 123ewewee        123EnglishEnglishEnglishEnglishEnglishEnglishEnglishEnglishEnglishEnglishEnglishEnglishEnglishEnglishEnglishEnglishEnglis Henglishenglishenglish           </p></body>

At this time the effect of the operation, such as the opening of the title, the following p tag dot style

CSS code:

. test{Word-break:break-all;}

Can find all the text, whether it is Chinese or English or the number can be in the end of the p tag of the package automatically forced career change, there will be a problem, will be a combination of the string split to see the effect of the effect, and then see a

CSS code:

. test {word-break:hyphenate;}


This CSS will potentially break the wrap element's character segment at the hyphenation point to advance the line

Look again

CSS code:

. test{Word-break:keep-all;}


Wraps the spaces between all the character segments and the character segments, preserving the integrity of all the character segments. Bursting package elements

Word-break also has some properties:

CSS code:

. test{Word-break:normal;} /* Browser Default line-break */


If you do not need to maintain the integrity of the word, break-all can solve the problem of bursting containers, because in the actual application process will not be more than a container width of the word, so hyphenate can solve the word is complete and can not burst container, Second, in some scenarios, scroll bars or overflow:hidden can be used to maintain the integrity of the interface.

  • 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.