Force line breaks and no line breaks in containers such as Div, TD, and P

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-allAndWord-wrap: Break-wordIs to make its container such as Div content automatically wrap

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.

3. Word-break; break-all supports version: ie5 or above, which is the same as normal in the Asian language. It also allows non-Asian text lines to be broken in any word. This value is suitable for Asian texts that contain non-Asian texts.

Word-wrap: Break-word supported version: ie5.5 and above will be wrapped in the boundary.

If necessary, the line feed (Word-break) also occurs. Automatic table line breaks to avoid opening.

Word-break: normal | break-All | keep-all

Parameters:

Normal: line breaks are allowed according to the text rules of the Asian and non-Asian languages.

Break-ALL: this behavior is the same as that of the Asian language normal. It also allows non-Asian text lines to be broken in any word. This value is applicable to Asian texts that contain non-Asian texts.

Keep-ALL: same as normal in all non-Asian languages. Chinese, Korean, and Japanese cannot be disconnected. It is applicable to non-Asian text syntaxes that contain a small number of Asian texts:

Word-wrap: normal | break-word

Parameters:

Normal: allows the content to expand the specified container boundary.

Break-word: the content will wrap in the boundary. If necessary, word-break also indicates whether to disconnect or retrieve the line break when the line breaks beyond the boundary of the specified container.

The corresponding script feature is wordwrap. For more information, see my other bibliography. Syntax: Table-layout: auto | fixed parameter: Auto: Default automatic algorithm. The layout is based on the content of each cell. The table is displayed only after each cell is read and computed. Slow fixed: Fixed Layout Algorithm. In this algorithm, the horizontal layout is based only on the table width, the table Border width, the cell spacing, and the column width, but it has nothing to do with the table content: sets or retrieves the Layout Algorithm of a table. The corresponding script feature is tablelayout.

Suggestion: If word-break is detected by 3c, a problem will be displayed, which may lead to Baidu snapshots.-The opera Firefox browser does not support the word-break attribute and can use white-space: normal; in this way, both Firefox and IE can get the correct line feed, and note that spaces between words cannot be used instead, otherwise the line feed cannot be correct.

 

Baidu

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.