CSS Learning notes: Text wrapping display (word-wrap)

Source: Internet
Author: User

The text wrapping property is newly defined in CSS3, Word-wrap:

    • The Nomal property value indicates that continuous text wrapping is controlled.
    • The Break-word property value indicates that the content will wrap within the bounds. Word Wrapping (Word-break) also occurs if desired.

Comparative analysis of line-wrapping technology

IE defines a number of line-wrapping properties: Line-break, Word-break, Word-wrap, and CSS1 defines WHITE-SPACE,CSS3 added Word-wrap.

    • Line-break is specifically responsible for controlling Japanese line breaks.
    • The Word-wrap property can control line breaks. When the property value is Word-wrap, the line will be forced, there is no problem with the Chinese text, and the English sentence is OK. But the long string of English does not work, Word-wrap:break-word is to control whether the word is broken, rather than the character breaker.
    • The Word-break property mainly controls line wrapping for Asian and non-Asian languages. When the property value is Break-all, you can allow any word in a non-Asian text line to break. When the property value is Keep-all, the word break is not allowed in Chinese, Japanese, or Korean.
    • The White-space property has visual text effect, and when the property value is nowrap, it forces the display of all text within the same line. When the property value is pre, a predefined text format is displayed.

Under IE, use Word-wrap:bireak-word; Declaration to make sure all text is displayed properly.

In the Firefox browser, the Chinese will not have any problems, the English sentence will not have problems, but long strings of English will be problematic . In order to solve the problem of long string of English, the general Word-wrap:break-word; and word-break:break-all; declarations are used together . However, this method causes the normal English word to be disconnected.

In order to solve this problem, Word-wrap:break-word;overflow:hiddencan be used instead of word-wrap:break-word;word-break:break-all; Word-wrap:break-word;overflow:hidden, there is no problem under IE, but in Firefox, a long list of English words will be covered.

CSS Learning notes: Text wrapping display (word-wrap)

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.