CSS3 Text Wrap word-wrap Resolve English text more than fixed width no line wrap

Source: Internet
Author: User
Tags word wrap

English text more than fixed width, do not change their own line of question must have met, in the past is used Overflow:hidden or JavaScript to control, when CSS3 appear, we can use CSS3 text line word-wrap to solve this problem

 

We sometimes encounter English text more than fixed width in the production, do not change their own line of issue. This sort of problem is mostly controlled by Overflow:hidden or JavaScript in the past, making it look close to perfection. When CSS3 appears, we can use the text of CSS3 to change lines word-wrap to solve this problem. Here is a brief introduction to CSS3 text line Word-wrap bar.

the grammar of a word-wrap

1. Grammar

Copy Code code as follows:


Word-wrap:normal | | Break-word


2, take the explanation
(1) Normal and Break-word, where normal is the default value, and when its value is normal controls continuous text wrapping (allowing the content to top open the container's boundary, in other words, the contents can burst the container);
(2) Break-word wrap the contents within the boundary

ii. compatibility of Word-wrap


iii. Examples of word-wrap

CSS code:

Copy Code code as follows:


Div {width:300px;height:200px;border:1px solid #ccc; word-wrap:break-word;}


HTML code:

Copy Code code as follows:


<div>menglongxiaozhan Menglongxiaozhan Dream Dragon Station Menglongxiaozhan Menglongxiaozhan Menglongxiaozhan Menglongxiaozhan Menglongxiao


Zhan Menglongxiaozhan Menglongxiaozhanmenglongxiaozhanmenglongxiaozhan Menglongxiaozhan menglongxiaozhan</ Div>


Preview Effect:

CSS3 Text line Word-wrap for you to introduce here, this property is basically compatible with all the mainstream browser, is a good attribute yo. More CSS3 attribute aspects of the introduction, enjoy the update of this blog.

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.