mozilla

Revision 19572 of white-space

  • Revision slug: CSS/white-space
  • Revision title: white-space
  • Revision id: 19572
  • Created:
  • Creator: j.j.
  • Is current revision? No
  • Comment 10 words added, 4 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 nowrap
5.5 (word-wrap:break-word)
6.0 pre (strict mode only)
Firefox 1.0 pre | nowrap | -moz-pre-wrap
3.0 pre-wrap
3.1 pre-line (-moz-pre-wrap dropped)
Opera 4.0 pre | nowrap
8.0 pre-wrap
9.5 pre-line
Safari 1.0 pre | nowrap
3.0 pre-wrap | pre-line

Internet Explorer 5.5+ supports word-wrap: break-word;
This is very similar to white-space: pre-wrap;

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/CSS1#white-space">CSS 1 #white-space</a></li> <li><a class="external" href="http://www.w3.org/TR/CSS21/text.html#white-space-prop">CSS 2.1 Text #white-space</a></li>
</ul><h3 name="Browser_compatibility">Browser compatibility </h3>
<table class="standard-table"> <tbody> <tr> <th>Browser</th> <th>Lowest Version</th> </tr> <tr> <td>Internet Explorer</td> <td>5.5<code> nowrap</code><br> 5.5<code> (word-wrap:break-word)</code><br> 6.0<code> pre</code> (strict mode only)</td> </tr> <tr> <td>Firefox</td> <td>1.0<code> pre | nowrap | -moz-pre-wrap</code><br> 3.0<code> pre-wrap</code><br> 3.1<code> pre-line </code>(<code>-moz-pre-wrap</code> dropped)</td> </tr> <tr> <td>Opera</td> <td>4.0<code> pre | nowrap</code><br> 8.0<code> pre-wrap</code><br> 9.5<code> pre-line</code></td> </tr> <tr> <td>Safari</td> <td>1.0<code> pre | nowrap</code><br> 3.0<code> pre-wrap | pre-line</code></td> </tr> </tbody>
</table>
<p>Internet Explorer 5.5+ supports<code> <strong>word-wrap: break-word</strong>;<br>
</code>This is very similar to<strong><code> white-space: pre-wrap;</code></strong></p><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