HTML div css force line feed without line feed

Source: Internet
Author: User

1. Force line breaks and end with a ellipsis.
<Div style = "width: 100px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;">
Why can't I see the results?
</Div>
2. css wrap
Div {word-wrap: break-word; word-break: normal ;}

3. css forces English words to be disconnected
Div {word-break: break-all ;}
For div nesting, to enable the inner div to wrap automatically based on the content, you can set only the div width of the outer and white-spance: nowrap.
 
Word-break: break-all and word-wrap: break-word both enable automatic line feed of its container content such as DIV
Their differences are:
1. word-break: break-all: for example, if the div width is PX, its content will be automatically wrapped in PX. If the end of the line has a long English word (congratulation, etc ), it truncates the word and converts it to the backend part of the row whose end is conra (congratulation) and the next row is tulation (conguatulation.
2. word-wrap: the break-word example is the same as above, but the difference is that it regards the entire word congratulation as a whole. If the end width of the row is insufficient, it automatically puts the entire word in the next line, instead of truncating the word.

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.