The use of Word-wrap attribute in CSS3 and examples

Source: Internet
Author: User
As we all know, the Word-wrap property is the new property of CSS3, then this article will give you a detailed explanation of how to use the Word-wrap property, as well as the precautions to use, see a small column below.

1. Definition

The Word-wrap property allows long words or URL addresses to wrap to the next line.

2. Syntax and parameters

Word-wrap:normal (default) |break-word Normal: Allows the content to be opened to the specified container boundary, and if the word is too long, it will be dashed out of the boundary (displayed in the current row, not wrapped). Break-word: Content will wrap within the boundary, and when the word does not fit in the current line, it will automatically switch to the next line, triggering word-break if necessary (note: Please distinguish between Word-break and Break-word are different things, one for the attribute parameter). Note: Each browser can be recognized.

3. Description

Word-wrap is the control of whether the line is broken or not, and whether to break a career change when the current row exceeds the bounds of the specified container. There is no problem in Chinese, and the English sentence is fine. But for long strings of English, it doesn't work.

4. Example

Congratulation this word belongs to a long string of English, Word-wrap:break-word 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 truncation, This is the explanation for the long string of words that do not work. Word-wrap:normal is the default, English words are not opened.

5. Summary

The scope of the function is only a div, such as standard block-level elements, th,td such table elements, although recognized but no effect (if the td,th plus width word-wrap in IE is able to play an effect, but according to the full compatibility of the convenient memory point of view or the previous conclusions prevail).


Believe that you have seen these cases you have mastered the method, more wonderful please pay attention to the PHP Chinese network other related articles!

Related reading:

How to change the mouse hover style without using CSS

HTML page dislocation reason and solution

JS manipulating the flow of Dom objects

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.