Cheap VPS & Xen Server

Residential Proxy Network - Hourly & Monthly Packages

CSS White Space


The CSS white space property is used to specify how to display the content within an element. It is used 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.

Value Description
normal This is a default value. in this value, text is wrapped when necessary. sequences of white space will collapse into a single whitespace.
nowrap Sequences of white space will collapse into a single whitespace. in this value, text will never wrap to the next line and only break when <br> tag is used.
pre Whitespace is preserved by the browser. it is act like html <pre> tag. text will only wrap on line breaks.
pre-line Sequences of white space will collapse into a single whitespace. texts are wrapped when necessary, and on line break.
pre-wrap Whitespace is preserved by the browser. texts are wrapped when necessary, and on line break.
initial It sets this property to its default value.
inherit It inherits this property from its parent element.

CSS White Space Example

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. p {
  6.     white-space: nowrap;
  7. }
  8. </style>
  9. </head>
  10. <body>
  11. <p>
  12. Write some text..Write some text..Write some text..
  13. Write some text..Write some text..Write some text..
  14. Write some text..Write some text..Write some text..
  15. Write some text..Write some text..Write some text..
  16. Write some text..Write some text..Write some text..
  17. </p>
  18. </body>
  19. </html>

Comments

comments