1. Home
  2. Computing & Technology
  3. Web Design / HTML

white-space

By Jennifer Kyrnin, About.com

white-space Description:

The white-space property defines how white space within the element is treated.

white-space in CSS Versions:

white-space Syntax:

white-space: normal | pre | nowrap | pre-wrap | pre-line | inherit

  • normal
    Collapse white space as usually happens in HTML documents.
  • pre
    Treat white space within elements as the <pre></pre> tag does.
  • nowrap
    Force wrapping only through the use of <br /> elements.
  • pre-wrap
    Prevents user agents from collapsing white space.
  • pre-line
    This value directs user agents to collapse sequences of white space.
  • inherit
    The element should have the same white-space setting as the parent.

white-space Initial Value:

normal

white-space Applies To:

All block-level elements.

white-space Inheritance:

This property is inherited.

white-space Browser Support:

white-space Examples:

display as pre-formatted text

<p style="white-space: pre;">
This paragraph
  will look pre-formatted.
</p>

white-space Special Notes:

  • Be careful using nowrap, as you can end up with really long strings of text that can play havoc with your design.
  • In CSS1 core, user-agents may ignore the white-space property and use default values instead.

More white-space Information:

Return to the Style Library

Explore Web Design / HTML

More from About.com

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. CSS
  5. Style Properties
  6. CSS Style Property: white-space

©2008 About.com, a part of The New York Times Company.

All rights reserved.