Introduction:

In this article we will to learn what is css white space property or how to use css white space property or css white space property with example.

 

Description:

The CSS white space property is used to specify how to handle the white spaces inside an element. 

CSS White Space values

There are many white space values that can be used to display the content inside an element. 

normal: White space is collapsed and lines are broken to fit.

Pre: White space is maintained and lines are not broken. The equivalent of the default styling of the HTML pre element.

Nowrap: White space is collapsed but lines are not broken.

pre-wrap: White space is maintained but lines are broken.

pre-line: White space is collapsed except for new lines, which are not. Lines are also broken to fit.


Example of CSS White Space property:

<!DOCTYPE html>
<html>
<head>
    <style>
        p {
            white-space: nowrap;
        }
    </style>
</head>
<body>
    <p>
        The CSS white space property is used to specify
        how to handle the white spaces inside an element.
        CSS White Space values
        There are many white space values that can be used
        to display the content inside an element.
    </p>
</body>
</html>


 Let's check live example

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

You may also like