index.mustache revision e0e25f8d302fa5ef03a5960832fd3eefec659ce3
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <div class="intro">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <p><em>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark<strong>Note:</strong> The files "fonts.css" and "fonts-context.css" are deprecated, use "cssfonts.css" and
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark"cssfonts-context.css" instead.</em></p>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <p>The foundational CSS Fonts provides cross-browser typographical normalization and control while still allowing users to choose and adjust their font size. Both Standards and Quirks modes are supported in A-grade browsers.</p>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <p><strong>Note:</strong> <a href="../cssbase/">CSS Base</a> can complement <a href="../cssreset/">CSS Reset</a> by applying a style foundation for common HTML elements that is consistent for <a href="http://developer.yahoo.com/yui/3/articles/gbs">A-grade browsers</a>.</p>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </div>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <h2 id="start">Getting Started</h2>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <h3 id="dependencies">Include Dependencies</h3>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <p>To use CSS Fonts, include the following source file in your web page with the link element:</p>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark```
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/{{yuiVersion}}/build/cssfonts/cssfonts-min.css">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark```
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <h3 id="context">Global vs. Contextual</h3>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
88fe6d2cfe60d200787b16076993a3fbdb4668a7mark <p>YUI's CSS resources apply rules to HTML elements directly (using <a href="http://www.w3.org/TR/CSS21/selector.html#type-selectors">type selectors</a>). An alternate version of the resource is available that target elements by context only. This contextual <code>-context.css</code> version selects HTML elements only when they descend from the <code>.yui3-cssfonts</code> classname.</p>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <p>Here is how to include the contextual version of CSS Fonts:</p>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark```
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark<!-- Source File -->
d5b26224b2955d6938bf85eb63a713e1ecd3d913mark<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/{{yuiVersion}}/build/cssfonts/cssfonts-context-min.css">
d5b26224b2955d6938bf85eb63a713e1ecd3d913mark```
d5b26224b2955d6938bf85eb63a713e1ecd3d913mark <h2 id="using">Using CSS Fonts</h2>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <h3 id="default">Default Text</h3>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <p>With the CSS linked into the page, all text renders in the Arial font, at 13 pixel size, with 16 pixel line-height. The <code>pre</code> and <code>code</code> elements use the "monospace" font-family. <a href="cssfonts-basic.html">Here's an example of HTML elements after Fonts has been applied</a>.</p>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <h3 id="fontsize">Font-size Adjustment</h3>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <p>To change the size of a font, always use percentages as the units because they render more consistently than ems, and because they allow user-initiated resizing (unlike pixels). <a href="cssfonts-size.html">See the example</a>.</p>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark```
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark#demo1 {font-size:85%;} /*renders 11px */
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark#demo2 {font-size:100%;} /*renders 13px */
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark#demo3 {font-size:108%;} /*renders 14px */
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark#demo4 {font-size:123.1%;} /*renders 16px */
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark#demo5 {font-size:138.5%;} /*renders 18px */
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark```
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <div id="fontsize-chart">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <table border="1" cellpadding="3" cellspacing="3" class="auto">
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <th class="first-col">For pixels (px)</th>
760976698b783a47fe7de0a3aaae012924009da7mark <th>Declare this percent (%)</th>
760976698b783a47fe7de0a3aaae012924009da7mark </tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="odd"><td class="first-col"> 10 </td><td> 77</td></tr>
760976698b783a47fe7de0a3aaae012924009da7mark <tr class="even"><td class="first-col"> 11 </td><td> 85 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="odd"><td class="first-col"> 12 </td><td> 93 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="even"><td class="first-col"> 13 </td><td> 100 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="odd"><td class="first-col"> 14 </td><td> 108 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="even"><td class="first-col"> 15 </td><td> 116 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="odd"><td class="first-col"> 16 </td><td> 123.1 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="even"><td class="first-col"> 17 </td><td> 131 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="odd"><td class="first-col"> 18 </td><td> 138.5 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="even"><td class="first-col"> 19 </td><td> 146.5 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="odd"><td class="first-col"> 20 </td><td> 153.9 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="even"><td class="first-col"> 21 </td><td> 161.6 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="odd"><td class="first-col"> 22 </td><td> 167 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="even"><td class="first-col"> 23 </td><td> 174 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="odd"><td class="first-col"> 24 </td><td> 182 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="even"><td class="first-col"> 25 </td><td> 189 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <tr class="odd"><td class="first-col"> 26 </td><td> 197 </td></tr>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </table>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark </div>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <h2 id="family">Font-family Adjustment</h2>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <p>Arial is the default font-family for all text (except <code>pre</code> and <code>code</code>) when you use Fonts CSS. Specify a new font-family when you want something other than Arial.</p>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
08248b5c5b494aff8d1922e8e0b5777796d7450dmark```
08248b5c5b494aff8d1922e8e0b5777796d7450dmark#demo1 {}
08248b5c5b494aff8d1922e8e0b5777796d7450dmark#demo2 {font-family:monospace;}
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark#demo3 {font-family:georgia;}
08248b5c5b494aff8d1922e8e0b5777796d7450dmark#demo4 {font-family:verdana;}
08248b5c5b494aff8d1922e8e0b5777796d7450dmark#demo5 {font-family:times;}
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark```
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <h3 id="start-contextually">Using CSS Fonts In Specific Contexts</h3>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <p>If you're using the contextual version, CSS Fonts's rules are only applied to elements that descend from a node with a class value of <code>.yui3-cssfonts</code>. The classname can go as high in the DOM tree as desired, including on the <code>&lt;HTML&ht;</code> element directly.</p>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <p>The following code snippet show how you might apply CSS Fonts to one of two columns:</p>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark```
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark<div>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <div class="yui3-cssfonts"><h1>Lorem Ipsum</h1></div>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark <div><h1>Lorem Ipsum</h1></div>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark</div>
51607ea01068c9047391e4c8b46bc9dbd0edb7fdmark```
08248b5c5b494aff8d1922e8e0b5777796d7450dmark
08248b5c5b494aff8d1922e8e0b5777796d7450dmark <p>Here is an example showing how to <a href="cssfonts-context.html">apply CSS Fonts to a subset of a page</a>.</p>
08248b5c5b494aff8d1922e8e0b5777796d7450dmark