CSS Equivalents for the pre Tag and nowrap Attribute

Posted: February 9, 2011 in HTML

Rarely have I used the <pre> tag or the nowrap attribute in my code. However it is there, and I haven’t even considered if there was a CSS alternative. Today I ran into the CSS property for these that I’ve never seen before; the white-space property.

Example:

p {white-space: nowrap}

The possible values are:

normal

nowrap – same as the nowrap attribute

pre – same as the <pre> tag

pre-line – text wraps when necessary and on line breaks

pre-wrap – whitespace is preserved by the browser (same as &nbsp;) and text will wrap when necessary and on line breaks

inherit – ( not supported by IE, including version 8 )

For additional reference see https://developer.mozilla.org/en-US/docs/CSS/white-space

Advertisements
Comments
  1. jonlariviere says:

    Looks like they may have moved your link to this page:
    http://www.w3schools.com/cssref/pr_text_white-space.asp

    Thanks for the post! Led me to where I needed to go!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s