CSS White-Space Property

In this chapter you will learn:
About white-space property
Values of this property
Example of this property

CSS white-space property is used to specify that how text can be handled on the element. This property can help you to wrap the content/text after line end, before line end etc. It also help you to set that the content will not wrap.

Values of this property
Values Description
normal Content/Text can wrap when necessary
pre Content/Text can’t wrap unless line breaks
pre-line Preserved by browser and wrap the text when necessary
initial Sets default value
inherit Inherits from parent.

Example of this property

<html>
<head>
   <title>Example of white-space property</title>
    <style type="text/css">
        #a
        {
            white-space:pre-line;
        }
        #b
        {
            white-space:nowrap;
        }                   
           
    </style>
    </head>
<body>
<p id="a">CSS white-space property is used to specify that how text can be handled on the element. This property can help you to wrap the content/text after line end, before line end etc. It also help you to set  that the content will not wrap. </p><br/>
<p id="b">CSS white-space property is used to specify that how text can be handled on the element. This property can help you to wrap the content/text after line end, before line end etc. It also help you to set  that the content will not wrap. </p>
</body>
</html>

Output:-
example of white-space property
SUMMARY

In this chapter, you have learned about the white-space property. Some other properties are given in next chapter so click on Next button to continue-

More Articles

 

Share your thought