font-size-adjust

  • Revision slug: CSS/font-size-adjust
  • Revision title: font-size-adjust
  • Revision id: 356703
  • Created:
  • Creator: teoli
  • Is current revision? No
  • Comment

Revision Content

{{ CSSRef() }}

Summary

The font-size-adjust CSS property specifies that font size should be chosen based on the height of lowercase letters rather than the height of capital letters.

This is useful since the legibility of fonts, especially at small sizes, is determined more by the size of lowercase letters than by the size of capital letters. This can cause problems when the first-choice {{ Cssxref("font-family") }} is unavailable and its replacement has a significantly different aspect ratio (the ratio of the size of lowercase letters to the size of the font).

To do this in a way that is compatible with browsers that do not support font-size-adjust, it is specified as a number that the {{ Cssxref("font-size") }} property is multiplied by. This means the value specified for the property should generally be the aspect ratio of the first choice font. For example, a style sheet that specifies

font-size: 14px;  font-size-adjust: 0.5;

is really specifying that the lowercase letters of the font should be 7px high (0.5 × 14px).

  • {{ Xref_cssinitial() }} {{ Cssinitial("font-size-adjust") }}
  • Applies to all elements
  • {{ Xref_cssinherited() }} yes
  • Media {{ Xref_cssvisual() }}
  • {{ Xref_csscomputed() }} as specified

Syntax

Formal syntax: {{csssyntax("font-size-adjust")}}
font-size-adjust: none
font-size-adjust: 3
font-size-adjust: 10.7

font-size-adjust: inherit

Values

none
Choose the size of the font based only on the {{ Cssxref("font-size") }} property.
<number>

Choose the size of the font so that its lowercase letters (as determined by the x-height metric of the font) are the specified number times the {{ Cssxref("font-size") }}.

The number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice {{ Cssxref("font-family") }}. This will mean that the first choice font, when available, will appear the same size in browsers, whether or not they support font-size-adjust.

Examples

{{ CSSRefExampleLink("font-size-adjust") }}

p {
   font: 12px Verdana, "DejaVu Sans", sans-serif;
   font-size-adjust: 0.58;
} 

Specifications

Specification Status Comment
{{ SpecName('CSS3 Fonts', '#propdef-font-size-adjust', 'font-size-adjust') }} {{ Spec2('CSS3 Fonts') }}  

The CSS property font-size-adjust was initially defined in CSS 2, but dropped in CSS 2.1. It has been newly defined in CSS 3.

Browser compatibility

{{ CompatibilityTable() }}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support {{ CompatNo() }}  1.0 (1.0)
Windows only
{{ CompatNo() }}  {{ CompatNo() }}  {{ CompatNo() }} 
{{ CompatGeckoDesktop("1.9") }}
All platforms
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support {{ CompatUnknown() }} {{ CompatGeckoMobile("1.9.2") }} {{ CompatUnknown() }} {{ CompatUnknown() }} {{ CompatUnknown() }}

See also

Revision Source

<p>{{ CSSRef() }}</p>
<h2 id="Summary">Summary</h2>
<p>The <code>font-size-adjust</code> CSS property specifies that font size should be chosen based on the height of lowercase letters rather than the height of capital letters.</p>
<p>This is useful since the legibility of fonts, especially at small sizes, is determined more by the size of lowercase letters than by the size of capital letters. This can cause problems when the first-choice {{ Cssxref("font-family") }} is unavailable and its replacement has a significantly different aspect ratio (the ratio of the size of lowercase letters to the size of the font).</p>
<p>To do this in a way that is compatible with browsers that do not support <code>font-size-adjust</code>, it is specified as a number that the {{ Cssxref("font-size") }} property is multiplied by. This means the value specified for the property should generally be the aspect ratio of the first choice font. For example, a style sheet that specifies</p>
<pre class="brush: css">
font-size: 14px;  font-size-adjust: 0.5;
</pre>
<p>is really specifying that the lowercase letters of the font should be <code>7px</code> high (0.5 × 14px).</p>
<ul class="cssprop">
  <li><dfn>{{ Xref_cssinitial() }}</dfn> {{ Cssinitial("font-size-adjust") }}</li>
  <li><dfn>Applies to</dfn> all elements</li>
  <li><dfn>{{ Xref_cssinherited() }}</dfn> yes</li>
  <li><dfn>Media</dfn> {{ Xref_cssvisual() }}</li>
  <li><dfn>{{ Xref_csscomputed() }}</dfn> as specified</li>
</ul>
<h2 id="Syntax">Syntax</h2>
<pre class="twopartsyntaxbox">
<a href="/en-US/docs/CSS/Value_definition_syntax" title="CSS/Value_definition_syntax">Formal syntax</a>: {{csssyntax("font-size-adjust")}}</pre>
<pre>
font-size-adjust: none
font-size-adjust: 3
font-size-adjust: 10.7

font-size-adjust: inherit
</pre>
<h3 id="Values">Values</h3>
<dl>
  <dt>
    <code>none</code></dt>
  <dd>
    Choose the size of the font based only on the {{ Cssxref("font-size") }} property.</dd>
  <dt>
    <code>&lt;number&gt;</code></dt>
  <dd>
    <p>Choose the size of the font so that its lowercase letters (as determined by the x-height metric of the font) are the specified number times the {{ Cssxref("font-size") }}.</p>
    <p>The number specified should generally be the aspect ratio (ratio of x-height to font size) of the first choice {{ Cssxref("font-family") }}. This will mean that the first choice font, when available, will appear the same size in browsers, whether or not they <code>support font-size-adjust</code>.</p>
  </dd>
</dl>
<h2 id="Examples">Examples</h2>
<p>{{ CSSRefExampleLink("font-size-adjust") }}</p>
<pre class="brush: css">
p {
   font: 12px Verdana, "DejaVu Sans", sans-serif;
   font-size-adjust: 0.58;
}&nbsp;</pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
  <thead>
    <tr>
      <th scope="col">Specification</th>
      <th scope="col">Status</th>
      <th scope="col">Comment</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>{{ SpecName('CSS3 Fonts', '#propdef-font-size-adjust', 'font-size-adjust') }}</td>
      <td>{{ Spec2('CSS3 Fonts') }}</td>
      <td>&nbsp;</td>
    </tr>
  </tbody>
</table>
<p>The CSS property <code>font-size-adjust</code> was initially defined in CSS 2, but dropped in CSS 2.1. It has been newly defined in CSS 3.</p>
<h2 id="Browser_Compatibility" 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 rowspan="2">Basic support</td>
        <td rowspan="2">{{ CompatNo() }}&nbsp;</td>
        <td>1.0 (1.0)<br />
          Windows only</td>
        <td rowspan="2">{{ CompatNo() }}&nbsp;</td>
        <td rowspan="2">{{ CompatNo() }}&nbsp;</td>
        <td rowspan="2">{{ CompatNo() }}&nbsp;</td>
      </tr>
      <tr>
        <td>{{ CompatGeckoDesktop("1.9") }}<br />
          All platforms</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&nbsp;Phone</th>
        <th>Opera Mobile</th>
        <th>Safari Mobile</th>
      </tr>
      <tr>
        <td>Basic support</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatGeckoMobile("1.9.2") }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
        <td>{{ CompatUnknown() }}</td>
      </tr>
    </tbody>
  </table>
</div>
<h2 id="See_also">See also</h2>
<ul>
  <li><a class="external" href="http://dbaron.org/log/20080613-firefox3-css#font-size-adjust" title="http://dbaron.org/log/20080613-firefox3-css#font-size-adjust">David Baron about font-size-adjust</a></li>
  <li>{{ CSS_Reference:Fonts() }}</li>
</ul>
Revert to this revision