HTML Div CSS forced line wrapping not wrapped

Source: Internet
Author: User
Tags word wrap
1. Force not to wrap and end with ellipsis.
<div style= "width:100px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" >
Hello friend friend friend why can't I see the effect?
</div>
2. CSS Auto-wrapping
div{Word-wrap:break-word; word-break:normal;}

3, CSS Force English word break
Div{word-break:break-all;}
If div nesting, to make the inner div according to the content of automatic line wrapping, you can only set the outer div width, and white-spance:nowrap can be.

Word-break:break-all and Word-wrap:break-word are all able to wrap the contents of their containers, such as Div.
The difference between them is:
1,word-break:break-all such as a div width of 200px, its content will go to 200px word wrap, if the end of the line has a long English words (congratulation, etc.), it will truncate the word, to the end of the line is Conra ( Congratulation), the backend portion of the next behavior tulation (conguatulation).
2,word-wrap:break-word example is the same as above, but the difference is that it will congratulation the whole word as a whole, if the line end width is not enough to display the whole word, it will automatically put the whole word to the next line, not the word truncated.

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