In CSS, the word-break and white-space attributes are used to set automatic line wrapping. The word-wrap attribute allows long words or URL addresses to wrap to the next line; and the white-space attribute can set text. Line break mode.
The operating environment of this article: windows7 system, css3 version, Dell G3 computer.
How to wrap lines in css?
css makes the container unable to fit in automatic line wrapping
css can set automatic line wrapping through the two properties of word-break and white-space. The word-wrap attribute allows long words or URL addresses to be wrapped to the next line. The white-space attribute can set the text wrapping method.
css makes the container unable to fit and wrap automatically:
css code:
<style type="text/css"> .linebr { clear: both; /* 清除左右浮动 */ width: 100px; /* 必须定义宽度 */ border:1px solid ;/*定义容器外边框*/ word-break: break-word; /* 文本行的任意字内断开 */ word-wrap: break-word; /* IE */ white-space: -moz-pre-wrap; /* Mozilla */ white-space: -hp-pre-wrap; /* HP printers */ white-space: -o-pre-wrap; /* 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.1 as well, actually) */ } </style>
HTML code:
Rendering:
word-break attribute:
The word-wrap attribute allows long words or URL addresses to be wrapped to the next line.
Syntax:
word-wrap: normal|break-word;
Attribute value:
normal Only line breaks at allowed hyphenation points (browsers keep default processing).
break-word Break lines inside long words or URL addresses.
white-space attribute
The white-space attribute sets how to handle white space within the element.
Attribute value:
normal Default. White space is ignored by the browser.
pre White space will be preserved by the browser. It behaves like the
tag in HTML. <p>nowrap The text will not wrap. The text will continue on the same line until the <br> tag is encountered. </p><p>pre-wrap Preserves whitespace sequences, but wraps normally. </p><p>pre-line merges whitespace sequences but retains newlines. </p><p>inherit specifies that the value of the white-space attribute should be inherited from the parent element. </p><p>Recommended learning: "<a href="https://www.php.cn/course/list/12.html" target="_blank">css video tutorial</a>"</p>
The above is the detailed content of How to wrap css. For more information, please follow other related articles on the PHP Chinese website!

The typical journey for a person browsing a website: view a page, click a link, browser loads new page. That's assuming no funny business like a Single Page

Let’s take a look at a super lightweight way to create a horizontal masonry effect for a set of arbitrarily-sized photos. Throw any set of photos at it, and

Different website designs often call for a shape other than a square or rectangle to respond to a click event. Perhaps your site has some kind of tilted or

Sophie Koonin blogged "Everything I googled in a week as a professional software engineer," which was a fascinating look into the mind of a web developer and

Interesting research from Jonathan Sampson, where he watches the network requests a browser makes the very first time you launch it on a fresh install, and

A collection of front-end development achievements. How many can you collect?

There are so many things you can do with clipping paths. I've been exploring them for quite some time and have come up with different techniques and use cases


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Zend Studio 13.0.1
Powerful PHP integrated development environment

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download
The most popular open source editor