Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1005241 of fallback

  • Revision slug: Web/CSS/@counter-style/fallback
  • Revision title: fallback
  • Revision id: 1005241
  • Created:
  • Creator: duncanmcdonald
  • Is current revision? No
  • Comment

Revision Content

Summary

The fallback descriptor can be used to specify a counter style to fall back to if the current counter style cannot create a marker representation for a particular counter value. If the specified fallback style is also unable to construct a representation, then its fallback style will be used. If a valid fallback style is not specified, it defaults to decimal. A few scenarios where fallback style will be used are:

  • When the {{cssxref('range')}} descriptor is specified for a counter style, the fallback style will be used to represent values that fall outside the range.
  • When the fixed {{cssxref('system')}} is used and there are not enough symbols to cover all the list items, the fallback style will be used for the rest of the list items.

{{cssinfo}}

Syntax

/* Keyword values */
fallback: lower-alpha;
fallback: custom-gangnam-style;

Formal syntax

{{csssyntax}}

Example

HTML Content

<ul class="list">
   <li>One</li>
   <li>Two</li>
   <li>Three</li>
   <li>Four</li>
   <li>Five</li>
</ul>

CSS Content

@counter-style fallback-example { 
  system: fixed; symbols: "\24B6" "\24B7" "\24B8"; 
  fallback: upper-alpha; 
} 
.list { 
  list-style: fallback-example; 
}

Live Example

{{ EmbedLiveSample('Example', '', '', '', 'Web/CSS/@counter-style/fallback') }}

The above list will display as follows:

Ⓐ. One
Ⓑ. Two
Ⓒ. Three
 D. Four
 E. Five

Specifications

Specification Status Comment
{{SpecName('CSS3 Counter Styles', '#counter-style-fallback', 'fallback')}} {{Spec2('CSS3 Counter Styles')}} Initial definition

Browser compatibility

{{CompatibilityTable}}

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatNo}} {{CompatGeckoDesktop(33)}} {{CompatNo}} {{CompatNo}} {{CompatNo}}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatNo}} {{CompatGeckoDesktop(33)}} {{CompatNo}} {{CompatNo}} {{CompatNo}}

See also

  • {{Cssxref("list-style")}}, {{Cssxref("list-style-image")}}, {{Cssxref("list-style-position")}}
  • {{cssxref("symbols", "symbols()")}}, the functional notation creating anonymous counter styles.

Revision Source

<h2 id="Summary">Summary</h2>

<p><span class="seoSummary">The <code>fallback</code> descriptor can be used to specify a counter style to fall back to if the current counter style cannot create a marker representation for a particular counter value.</span> If the specified fallback style is also unable to construct a representation, then its fallback style will be used. If a valid fallback style is not specified, it defaults to <code>decimal</code>. A few scenarios where fallback style will be used are:</p>

<ul>
 <li>When the {{cssxref('range')}} descriptor is specified for a counter style, the fallback style will be used to represent values that fall outside the range.</li>
 <li>When the <code>fixed</code> {{cssxref('system')}} is used and there are not enough symbols to cover all the list items, the fallback style will be used for the rest of the list items.</li>
</ul>

<p>{{cssinfo}}</p>

<h2 id="Syntax">Syntax</h2>

<pre class="brush: css">
/* Keyword values */
fallback: lower-alpha;
fallback: custom-gangnam-style;
</pre>

<h3 id="Formal_syntax">Formal syntax</h3>

<pre class="syntaxbox">
{{csssyntax}}</pre>

<h2 id="Example" name="Example">Example</h2>

<h3 id="HTML_Content">HTML Content</h3>

<div id="htmlOutputWrapper">
<pre class="brush: html" id="htmlOutput">
<span class="tag">&lt;ul</span><span class="pln"> </span><span class="atn">class</span><span class="pun">=</span><span class="atv">"list"</span><span class="tag">&gt;</span><span class="pln">
   </span><span class="tag">&lt;li&gt;</span><span class="pln">One</span><span class="tag">&lt;/li&gt;</span><span class="pln">
   </span><span class="tag">&lt;li&gt;</span><span class="pln">Two</span><span class="tag">&lt;/li&gt;</span><span class="pln">
   </span><span class="tag">&lt;li&gt;</span><span class="pln">Three</span><span class="tag">&lt;/li&gt;</span><span class="pln">
   </span><span class="tag">&lt;li&gt;</span><span class="pln">Four</span><span class="tag">&lt;/li&gt;</span><span class="pln">
   </span><span class="tag">&lt;li&gt;</span><span class="pln">Five</span><span class="tag">&lt;/li&gt;</span><span class="pln">
</span><span class="tag">&lt;/ul&gt;</span></pre>
</div>

<h3 id="CSS_Content">CSS Content</h3>

<pre class="brush: css">
@counter-style fallback-example { 
  system: fixed; symbols: "\24B6" "\24B7" "\24B8"; 
  fallback: upper-alpha; 
} 
.list { 
  list-style: fallback-example; 
}</pre>

<h3 id="Live_Example">Live Example</h3>

<p>{{ EmbedLiveSample('Example', '', '', '', 'Web/CSS/@counter-style/fallback') }}</p>

<p>The above list will display as follows:</p>

<p>Ⓐ. One<br />
 Ⓑ. Two<br />
 Ⓒ. Three<br />
 &nbsp;D. Four<br />
 &nbsp;E. Five</p>

<h2 id="Specifications" name="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 Counter Styles', '#counter-style-fallback', 'fallback')}}</td>
   <td>{{Spec2('CSS3 Counter Styles')}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="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</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatGeckoDesktop(33)}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</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>Basic support</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatGeckoDesktop(33)}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li>{{Cssxref("list-style")}}, {{Cssxref("list-style-image")}}, {{Cssxref("list-style-position")}}</li>
 <li>{{cssxref("symbols", "symbols()")}}, the functional notation creating anonymous counter styles.</li>
</ul>
Revert to this revision