Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize line break in CSS3

Shulou Source: shulou.com Published: 2022-06-01 06:41:11 09月11日 Update

This article introduces the relevant knowledge of "how to achieve line change in CSS3". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

CSS3TextOverflow attribute

The CSS3 text overflow property specifies how the overflow content should be displayed to the user

Example

P.test1 {

White-space: nowrap

Width: 200px

Border: 1px solid # 000000

Overflow: hidden

Text-overflow: clip

}

P.test2 {

White-space: nowrap

Width: 200px

Border: 1px solid # 000000

Overflow: hidden

Text-overflow: ellipsis

}

Line feeds of CSS3

If a word is too long to fit in an area, it extends to the outside:

In CSS3, the auto-wrap attribute allows you to force text wrapping-even if it means splitting a word in the middle of it:

The CSS code is as follows:

Example

Allow long text to wrap:

P {word-wrap:break-word;}

CSS3 word splitting and newline

The CSS3 word split newline property specifies the newline rule:

The CSS code is as follows:

Example

P.test1 {

Word-break: keep-all

}

P.test2 {

Word-break: break-all

}

This is the end of the content of "how to change lines in CSS3". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Attributes content words examples text code more knowledge practicality achievement next region dilemma reality situation meaning articles cases users editing Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Shulou Technology NVidia Apple Huawei