CSS-line feed and css line feed

Source: Internet
Author: User
Tags split words

CSS-line feed and css line feed

About text overflow line feed problem, first look at the relevant attributes involved with line feed, view: http://www.w3school.com.cn

I. word-break

Definition: the word-break attribute specifies the processing method for automatic line feed.

Value Description
Normal Use the default line feed rule of the browser.
Break-all Line breaks are allowed in words.
Keep-all You can only wrap a line at a halfwidth space or a hyphen.

 

 

 

 

 

 

2. word-wrap

Definition: the word-wrap attribute allows long words or URLs to wrap into the next line.

Value Description
Normal Wrap only at the allowed broken word points (the browser keeps processing by default ).
Break-word Wrap a line in a long word or URL address.

 

 

 

 

For non-CJK text (such as English) line feed rules, word-wrap: break-wordTo switch long words to the next line (split words ).

CJK (Chinese/Japanese/Korean)

Iii. white-space

Definition: how to process the white-space attribute settings.

Value Description
Normal Default value. The blank space is ignored by the browser.
Pre The blank space is retained by the browser. The behavior is similar to the <pre> label in HTML.
Nowrap The text will not wrap, and the text will continue on the same line until the <br> label is encountered.
Pre-wrap The blank character sequence is retained, but the line feed is normal.
Pre-line Merges the blank character sequence, but retains the line break.
Inherit Specifies that the value of the white-space attribute should be inherited from the parent element.

 

 

 

 

 

 

 

 

 

 

Iv. application scenarios

If you have a good understanding of the above attributes, it would be nice if you do not know it clearly. Please see the effect: demonstration effect, runjs

Below is:

1. Default

 

2. word-break: break-all

 

3. word-wrap: break-word

 

4. white-space: nowrap

V. Conclusion

I hope this will be helpful to you. Please correct the error. The article will be changed or updated from time to time. Please indicate the source for reprinting to facilitate tracing.

 

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.