white-space

  • Revision slug: CSS/white-space
  • Revision title: white-space
  • Revision id: 19558
  • Created:
  • Creator: Kliu0x52
  • Is current revision? No
  • Comment /* Notes */ Remove not about pre-wrap not implemented

Revision Content

{{template.CSSRef()}}

Summary

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

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

Syntax

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

Values

{{template.Cssxref("normal")}}
all sequences of whitespace and line breaks will be collapsed. Line breaks are add to wrap the content.
{{template.Cssxref("pre")}}
all white spaces in the source will be preserved, lines are only broken at newline characters in the source.
{{template.Cssxref("nowrap")}}
all sequences of whitespace and line breaks will be collapsed, also line breaks (text wrapping) are suppressed within content.
{{template.Cssxref("pre-wrap")}} {{template.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.
{{template.Cssxref("-moz-pre-wrap")}} {{template.Deprecated_inline()}}
Same as pre-wrap, this is the Mozilla extension which became the CSS 2.1 pre-wrap, which should be used instead.
{{template.Cssxref("pre-line")}}
all sequences of whitespace will be collapsed, lines are broken at newline characters and also as needed to wrap the content.
{{template.Cssxref("inherit")}}
inherits from parent.

Examples

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

code {
  white-space: pre;
}

Notes

pre-line is not yet implemented in Mozilla.

Specifications

Browser compatibility

(Sample Compatibility Chart)

Browser Lowest Version
Internet Explorer 0
Firefox 0
Netscape 0
Opera 0
Safari ?


See also

{{wiki.template('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")}}

Revision Source

<p> 
{{template.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> {{template.Xref_cssinitial()}}: {{template.Cssxref("normal")}}
</li><li> Applies to: all elements 
</li><li> {{template.Xref_cssinherited()}}: yes
</li><li> Percentages: n/a
</li><li> Media: {{template.Xref_cssvisual()}}
</li><li> {{template.Xref_csscomputed()}}: as specified 
</li></ul>
<h3 name="Syntax"> Syntax </h3>
<pre class="eval">white-space: normal | pre | nowrap | pre-wrap | -moz-pre-wrap | pre-line | inherit ;
</pre>
<h3 name="Values"> Values </h3>
<dl><dt>{{template.Cssxref("normal")}}
</dt><dd>all sequences of whitespace and line breaks will be collapsed. Line breaks are add to wrap the content.
</dd><dt>{{template.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>{{template.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>{{template.Cssxref("pre-wrap")}} {{template.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.
</dd><dt>{{template.Cssxref("-moz-pre-wrap")}} {{template.Deprecated_inline()}}
</dt><dd>Same as <code>pre-wrap</code>, this is the Mozilla extension which became the CSS 2.1 <code>pre-wrap</code>, which should be used instead.
</dd><dt>{{template.Cssxref("pre-line")}}
</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>{{template.Cssxref("inherit")}}
</dt><dd>inherits from parent.
</dd></dl>
<h3 name="Examples"> Examples </h3>
<p>{{template.CSSRefExampleLink("white-space")}}
</p>
<pre class="eval">code {
  white-space: pre;
}
</pre>
<h3 name="Notes"> Notes </h3>
<p><code>pre-line</code> is not yet implemented in Mozilla.
</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>(Sample Compatibility Chart)
</p>
<table class="standard-table">
  <tbody><tr>
    <th>Browser</th>
    <th>Lowest Version</th>
  </tr>
  <tr>
    <td>Internet Explorer</td>
    <td>0</td>
  </tr>
  <tr>
    <td>Firefox</td>
    <td>0</td>
  </tr>
  <tr>
    <td>Netscape</td>
    <td>0</td>
  </tr>
  <tr>
    <td>Opera</td>
    <td>0</td>
  </tr>
  <tr>
    <td>Safari</td>
    <td>?</td>
  </tr>
</tbody></table>
<p><br>
</p>
<h3 name="See_also"> See also </h3>
<p>{{wiki.template('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>
Revert to this revision