Home > Web Front-end > CSS Tutorial > How to control text not to wrap in css

How to control text not to wrap in css

王林
Release: 2020-11-30 16:43:21
Original
3705 people have browsed it

How to control text not wrapping in css: You can use the white space attribute to control it, such as [white-space:nowrap;]. The white space attribute specifies how to handle the white space within the element. Normal means that the browser ignores the white space.

How to control text not to wrap in css

The operating environment of this tutorial: Windows 10 system, CSS3 version. This method is suitable for all brands of computers.

(Learning video sharing: css video tutorial)

How to control text in css without wrapping:

Use white- The space attribute specifies how to handle whitespace within the element.

Attribute value:

  • normal Default. White space is ignored by the browser.

  • #pre Blank spaces will be retained by the browser. It behaves like the

     tag in HTML. </p></li>
    <li><p>nowrap The text will not wrap. The text will continue on the same line until the <br> tag is encountered. </p></li>
    <li><p>pre-wrap Preserves whitespace sequences, but wraps normally. </p></li>
    <li><p>#pre-line Merges whitespace sequences, but retains newlines. </p></li>
    <li><p>#inherit Specifies that the value of the white-space attribute should be inherited from the parent element. </p></li>
    </ul>
    <p>Example:</p><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:css;toolbar:false">p{
        white-space:nowrap;
    }
    Copy after login

Related recommendations:CSS tutorial

The above is the detailed content of How to control text not to wrap in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template