mozilla

Revision 19566 of white-space

  • Revision slug: CSS/white-space
  • Revision title: white-space
  • Revision id: 19566
  • Created:
  • Creator: j.j.
  • Is current revision? No
  • Comment 60 words added, 10 words removed

Revision Content

{{ CSSRef() }}

Summary

The white-space CSS property is used to to describe how whitespace inside the element is handled.

  • {{ Xref_cssinitial() }}: {{ Cssxref("normal") }}
  • Applies to: all elements
  • {{ Xref_cssinherited() }}: yes
  • Percentages: n/a
  • Media: {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }}: as specified

Syntax

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

Values

{{ Cssxref("normal") }}
All sequences of whitespace and line breaks will be collapsed. Line breaks are add to wrap the content.
{{ Cssxref("pre") }}
All white spaces in the source will be preserved, lines are only broken at newline characters in the source.
{{ Cssxref("nowrap") }}
All sequences of whitespace and line breaks will be collapsed, also line breaks (text wrapping) are suppressed within content.
{{ Cssxref("pre-wrap") }} {{ Fx_minversion_inline("3") }}
All white spaces in the source will be preserved, lines are broken at newline characters and as needed to wrap the content. For backward compatibility with Firefox 2, you may wish to also include -moz-pre-wrap, which does the same thing in older versions of Firefox but is ignored in Firefox 3.1 and later.
{{ Cssxref("pre-line") }} {{ Fx_minversion_inline("3") }}
All sequences of whitespace will be collapsed, lines are broken at newline characters and also as needed to wrap the content.
{{ Cssxref("inherit") }}
inherits from parent.

Examples

{{ CSSRefExampleLink("white-space") }}

code {
  white-space: pre;
}

Notes

pre-line is not implemented in Mozilla prior to Gecko 1.9.1.

Specifications

Browser compatibility

 

Browser Lowest Version
Internet Explorer 5.5
Firefox 1.0
Netscape ?
Opera 4.0
Safari 1.0
  • pre is supported since Internet Explorer 6 , strict mode only.
  • pre-wrap is supportet since Safari 3.0 and Opera 8.0 .
  • Internet Explorer 5.5+ supports word-wrap: break-word; to achieve the same effect.
  • pre-line is supportet since Safari 3.0 and Opera 9.5 .

See also

{{ CSS_Reference:Text() }}


uncomment as required {{ mediawiki.internal('Category:NeedsContent', "en") }} {{ mediawiki.internal('Category:NeedsAttention', "en") }} {{ mediawiki.internal('Category:NeedsExample', "en") }} {{ mediawiki.internal('Category:NeedsImageCleanup', "en") }} {{ mediawiki.internal('Category:NeedsMarkupWork', "en") }} {{ mediawiki.internal('Category:NeedsRewrite', "en") }} {{ mediawiki.internal('Category:NeedsTechnicalReview', "en") }} {{ mediawiki.internal('Category:NeedsEditorialReview', "en") }} {{ mediawiki.internal('Category:NeedsUpdate', "en") }}

{{ languages( { "pl": "pl/CSS/white-space" } ) }}

Revision Source

<p>{{ CSSRef() }}</p>
<h3 name="Summary">Summary</h3>
<p>The <code>white-space</code> CSS property is used to to describe how whitespace inside the element is handled.</p>
<ul> <li>{{ Xref_cssinitial() }}: {{ Cssxref("normal") }}</li> <li>Applies to: all elements</li> <li>{{ Xref_cssinherited() }}: yes</li> <li>Percentages: n/a</li> <li>Media: {{ Xref_cssvisual() }}</li> <li>{{ Xref_csscomputed() }}: as specified</li>
</ul>
<h3 name="Syntax">Syntax</h3>
<pre class="eval">white-space: normal | pre | nowrap | pre-wrap | pre-line | inherit ;
</pre>
<h3 name="Values">Values</h3>
<dl><dt>{{ Cssxref("normal") }} </dt><dd>All sequences of whitespace and line breaks will be collapsed. Line breaks are add to wrap the content. </dd><dt>{{ Cssxref("pre") }} </dt><dd>All white spaces in the source will be preserved, lines are only broken at newline characters in the source. </dd><dt>{{ Cssxref("nowrap") }} </dt><dd>All sequences of whitespace and line breaks will be collapsed, also line breaks (text wrapping) are suppressed within content. </dd><dt>{{ Cssxref("pre-wrap") }} {{ Fx_minversion_inline("3") }} </dt><dd>All white spaces in the source will be preserved, lines are broken at newline characters and as needed to wrap the content. For backward compatibility with Firefox 2, you may wish to also include <code>-moz-pre-wrap</code>, which does the same thing in older versions of Firefox but is ignored in Firefox 3.1 and later.<br>
</dd><dt>{{ Cssxref("pre-line") }} {{ Fx_minversion_inline("3") }} </dt><dd>All sequences of whitespace will be collapsed, lines are broken at newline characters and also as needed to wrap the content. </dd><dt>{{ Cssxref("inherit") }} </dt><dd>inherits from parent. </dd></dl>
<h3 name="Examples">Examples</h3>
<p>{{ CSSRefExampleLink("white-space") }}</p>
<pre class="eval">code {
  white-space: pre;
}
</pre>
<h3 name="Notes">Notes</h3>
<p><code>pre-line</code> is not implemented in Mozilla prior to Gecko 1.9.1.</p>
<h3 name="Specifications">Specifications</h3>
<ul> <li><a class="external" href="http://www.w3.org/TR/CSS21/text.html#white-space-prop">CSS 2.1 text</a></li> <li><a class="external" href="http://www.w3.org/TR/CSS1#white-space">CSS 1</a></li> <li><a class="external" href="http://www.w3.org/TR/css3-text/#white-space-summary">CSS 3</a></li>
</ul>
<h3 name="Browser_compatibility">Browser compatibility</h3>
<p> </p>
<table class="standard-table"> <tbody> <tr> <th>Browser</th> <th>Lowest Version</th> </tr> <tr> <td>Internet Explorer</td> <td>5.5</td> </tr> <tr> <td>Firefox</td> <td>1.0</td> </tr> <tr> <td>Netscape</td> <td>?</td> </tr> <tr> <td>Opera</td> <td>4.0</td> </tr> <tr> <td>Safari</td> <td>1.0</td> </tr> </tbody>
</table>
<ul> <li><strong>pre</strong> is supported since Internet Explorer 6 , strict mode only.</li>
</ul>
<ul> <li><strong>pre-wrap</strong> is supportet since Safari 3.0 and Opera 8.0 . </li> <li>Internet Explorer 5.5+ supports <strong>word-wrap: break-word;</strong> to achieve the same effect.</li>
</ul>
<ul> <li><strong>pre-line</strong> is supportet since Safari 3.0 and Opera 9.5 .</li>
</ul>
<h3 name="See_also">See also</h3>
<p>{{ CSS_Reference:Text() }}</p>
<p><br>
<span class="comment">uncomment as required {{ mediawiki.internal('Category:NeedsContent', "en") }} {{ mediawiki.internal('Category:NeedsAttention', "en") }} {{ mediawiki.internal('Category:NeedsExample', "en") }} {{ mediawiki.internal('Category:NeedsImageCleanup', "en") }} {{ mediawiki.internal('Category:NeedsMarkupWork', "en") }} {{ mediawiki.internal('Category:NeedsRewrite', "en") }} {{ mediawiki.internal('Category:NeedsTechnicalReview', "en") }} {{ mediawiki.internal('Category:NeedsEditorialReview', "en") }} {{ mediawiki.internal('Category:NeedsUpdate', "en") }}</span></p>
<p>{{ languages( { "pl": "pl/CSS/white-space" } ) }}</p>
Revert to this revision