The <white-space> Property

CSS Properties

The <white-space> property

The possible values of the white-space property are:

inherit
use the value of the white-space property from the style attribute coded on the current element's parent or inherited from one of its ancestors
normal
nowrap
pre
pre-line
pre-wrap

Examples

To prevent text from potentially wrapping at an inappropriate place, you can code the white-space: nowrap property. This example is an alternative to coding &nbsp; (non-breaking space).

<span style="white-space: nowrap">12:00 pm</span> is noon

Since HTML coders should avoid the deprecated <nobr> tag, you can include white-space: nowrap in a CSS file, and code <span> tags with class="nobr" instead:

<span class="nobr">12:00 am</span> is midnight
.nobr {
white-space: nowrap;
}

Prev: text-decoration Next: HTML Color Codes 

Home > CSS Properties > white-space

Viewing mobile website page. Switch to WML or Full HTML