letter-spacing

  • Revision slug: CSS/letter-spacing
  • Revision title: letter-spacing
  • Revision id: 40904
  • Created:
  • Creator: brianloveswords
  • Is current revision? No
  • Comment one or more formatting changes

Revision Content

{{ CSSRef() }}

Summary

The letter-spacing CSS property specifies spacing behavior between text characters.

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

 

Syntax

letter-spacing:  normal | <length>

Values

normal
The spacing is the normal spacing for the current font. This value allows the user agent to alter the space between characters in order to justify text. That's the difference to the length value 0.
<length>
Indicates inter-character space in addition to the default space between characters. Values may be negative, but there may be implementation-specific limits. User agents may not further increase or decrease the inter-character space in order to justify text.
See {{ Xref_csslength() }} values for possible units.

Examples

Having a css style of:

p { letter-spacing: 0.4em }

and a webpage with the code:

<p> letter spacing </p>

will produce the following:

letter spacing


Here are some more letter spacing examples:

letter-spacing: 0.1em
letter-spacing: 0.5em
letter-spacing: 0.8em
letter-spacing: 1em
letter-spacing: -0.05em
letter-spacing: 6px

 

Specifications

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
HTML support 1.0 {{ CompatGeckoDesktop("1") }} 4.0 3.5 1.0 (85)
SVG support {{ CompatVersionUnknown() }} {{ CompatNo() }} ({{ bug("371787") }}) {{ CompatUnknown() }} {{ CompatVersionUnknown() }} {{ CompatVersionUnknown() }}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
HTML support {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}
SVG support {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

See also

{{ CSS_Reference:Text() }}

{{ languages( { "pl": "pl/CSS/letter-spacing", "fr": "fr/CSS/letter-spacing" } ) }}

Revision Source

<p>{{ CSSRef() }}</p>
<h2 name="Summary">Summary</h2>
<p>The<code> letter-spacing </code>CSS property specifies spacing behavior between text characters.</p>
<ul class="cssprop" style="display:table;padding: 0.4em;border-left:0.15em solid;background-color:#eeeeff"> <li style="display:table-row;padding: 3px;margin:0;"><dfn style="display:table-cell;padding: 0 5px;border-bottom: none;cursor:inherit;">{{ Xref_cssinitial() }}:</dfn> {{ Cssxref("normal") }}</li> <li style="display:table-row;padding: 3px;margin:0;"><dfn style="display:table-cell;padding: 0 5px;border-bottom: none;cursor:inherit;">Applies to:</dfn> all elements</li> <li style="display:table-row;padding: 3px;margin:0;"><dfn style="display:table-cell;padding: 0 5px;border-bottom: none;cursor:inherit;">{{ Xref_cssinherited() }}:</dfn> yes</li> <li style="display:table-row;padding: 3px;margin:0;"><dfn style="display:table-cell;padding: 0 5px;border-bottom: none;cursor:inherit;">Percentages:</dfn> n/a</li> <li style="display:table-row;padding: 3px;margin:0;"><dfn style="display:table-cell;padding: 0 5px;border-bottom: none;cursor:inherit;">Media:</dfn> {{ Xref_cssvisual() }}</li> <li style="display:table-row;padding: 3px;margin:0;"><dfn style="display:table-cell;padding: 0 5px;border-bottom: none;cursor:inherit;">{{ Xref_csscomputed() }}:</dfn> <code>normal </code>or absolute length</li>
</ul>
<p> </p>
<h2 name="Syntax">Syntax</h2>
<pre class="eval">letter-spacing:  normal | &lt;length&gt;
</pre>
<h2 name="Values">Values</h2>
<dl> <dt>normal</dt> <dd>The spacing is the normal spacing for the current font. This value allows the user agent to alter the space between characters in order to justify text. That's the difference to the length value<code> 0</code>.</dd> <dt>&lt;length&gt;</dt> <dd>Indicates inter-character space <strong><em>in addition to</em></strong> the default space between characters. Values may be negative, but there may be implementation-specific limits. User agents may not further increase or decrease the inter-character space in order to justify text.<br> See {{ Xref_csslength() }} values for possible units.</dd>
</dl>
<h2 name="Examples">Examples</h2>
<p>Having a css style of:</p>
<pre class="brush: css">p { letter-spacing: 0.4em }
</pre>
<p>and a webpage with the code:</p>
<pre class="brush: html">&lt;p&gt; letter spacing &lt;/p&gt;
</pre>
<p>will produce the following:</p>
<pre><span style="letter-spacing: 0.4em;">letter spacing</span>
</pre>
<p><br> Here are some more letter spacing examples:</p>
<pre><span style="letter-spacing: 0.1em;">letter-spacing: <strong>0.1em</strong></span>
<span style="letter-spacing: 0.5em;">letter-spacing: <strong>0.5em</strong></span>
<span style="letter-spacing: 0.8em;">letter-spacing: <strong>0.8em</strong></span>
<span style="letter-spacing: 1em;">letter-spacing: <strong>1em</strong></span>
<span style="letter-spacing: -0.05em;">letter-spacing: <strong>-0.05em</strong></span>
<span style="letter-spacing: 6px;">letter-spacing: <strong>6px</strong></span>
</pre>
<p> </p>
<h2 name="Specifications">Specifications</h2>
<ul> <li><a class="external" href="http://www.w3.org/TR/CSS21/text.html#propdef-letter-spacing" title="http://www.w3.org/TR/CSS21/text.html#propdef-letter-spacing">CSS 2.1 Text #letter-spacing</a></li> <li><a class="external" href="http://www.w3.org/TR/SVG11/text.html#LetterSpacingProperty" title="http://www.w3.org/TR/SVG11/text.html#LetterSpacingProperty">SVG 1.1 Text #letter-spacing</a></li>
</ul>
<h2 name="Browser_compatibility">Browser compatibility</h2>
<p>{{ CompatibilityTable() }}</p>
<div id="compat-desktop"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Chrome</th> <th>Firefox (Gecko)</th> <th>Internet Explorer</th> <th>Opera</th> <th>Safari (WebKit)</th> </tr> <tr> <td>HTML support</td> <td>1.0</td> <td>{{ CompatGeckoDesktop("1") }}</td> <td>4.0</td> <td>3.5</td> <td>1.0 (85)</td> </tr> <tr> <td>SVG support</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatNo() }} ({{ bug("371787") }})</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> <td>{{ CompatVersionUnknown() }}</td> </tr> </tbody> </table>
</div>
<div id="compat-mobile"> <table class="compat-table"> <tbody> <tr> <th>Feature</th> <th>Android</th> <th>Firefox Mobile (Gecko)</th> <th>IE Mobile</th> <th>Opera Mobile</th> <th>Safari Mobile</th> </tr> <tr> <td>HTML support</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> </tr> <tr> <td>SVG support</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> <td>{{ CompatUnknown() }}</td> </tr> </tbody> </table>
</div>
<h2 name="See_also">See also</h2>
<p>{{ CSS_Reference:Text() }}</p>
<p>{{ languages( { "pl": "pl/CSS/letter-spacing", "fr": "fr/CSS/letter-spacing" } ) }}</p>
Revert to this revision