Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize line wrapping beyond automatic line wrapping compatible with multiple browsers

Shulou Source: shulou.com Published: 2022-06-03 08:05:29 10月03日 Update

This article introduces the knowledge of "how to achieve more than partial automatic line wrapping compatible with multiple browsers". In the operation of practical 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!

The code is as follows:

.linebr {

Clear: both; / * clear left and right floats * /

Width: 100px; / * width must be defined * /

Word-break: break-word; / * disconnect within any word of a line of text * /

Word-wrap: break-word; / * IE * /

White-space:-moz-pre-wrap; / * Mozilla * /

White-space:-hp-pre-wrap; / * HP printers * /

White-space:-Omurmurwrap. Opera 7 * /

White-space:-pre-wrap; / * Opera 4-6 * /

White-space: pre; / * CSS2 * /

White-space: pre-wrap; / * CSS 2.1 * /

White-space: pre-line; / * CSS 3 (and 2.1as well, actually) * /

}

When the width of the specified container is full, the effect of automatic line wrapping, this string of code is not original, but has been used in the project, and then recorded as its own record. It is also convenient for me to use it again in the future.

You can also test: directly add a setting to the style: word-break:break-all

Note: be sure to set the width of the container

This is the end of the content of "how to achieve more than partial line wrapping compatible with multiple browsers". Thank you for 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: Width browser part browse code content container more knowledge practicality achievement next use again just dilemma reality situation effect article Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Redmi Apple Docker Linux