7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <div class="intro">
e0e25f8d302fa5ef03a5960832fd3eefec659ce3Matt Sweeney<strong>Note:</strong> The files "fonts.css" and "fonts-context.css" are deprecated, use "cssfonts.css" and
e0e25f8d302fa5ef03a5960832fd3eefec659ce3Matt Sweeney"cssfonts-context.css" instead.</em></p>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <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>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <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>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <h2 id="start">Getting Started</h2>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <h3 id="dependencies">Include Dependencies</h3>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <p>To use CSS Fonts, include the following source file in your web page with the link element:</p>
90c2e60494a1efb7a25dd97066523a0d1890ace9Matt Sweeney<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/{{yuiVersion}}/build/cssfonts/cssfonts-min.css">
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <h3 id="context">Global vs. Contextual</h3>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <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>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <p>Here is how to include the contextual version of CSS Fonts:</p>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney<!-- Source File -->
90c2e60494a1efb7a25dd97066523a0d1890ace9Matt Sweeney<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/{{yuiVersion}}/build/cssfonts/cssfonts-context-min.css">
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <h2 id="using">Using CSS Fonts</h2>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <h3 id="default">Default Text</h3>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <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>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <h3 id="fontsize">Font-size Adjustment</h3>
b8307d4f04422e45ed2240b070dbfd46876f3c9eMatt Sweeney <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>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney#demo1 {font-size:85%;} /*renders 11px */
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney#demo2 {font-size:100%;} /*renders 13px */
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney#demo3 {font-size:108%;} /*renders 14px */
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney#demo4 {font-size:123.1%;} /*renders 16px */
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney#demo5 {font-size:138.5%;} /*renders 18px */
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <div id="fontsize-chart">
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <table border="1" cellpadding="3" cellspacing="3" class="auto">
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <th class="first-col">For pixels (px)</th>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <th>Declare this percent (%)</th>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="odd"><td class="first-col"> 10 </td><td> 77</td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="even"><td class="first-col"> 11 </td><td> 85 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="odd"><td class="first-col"> 12 </td><td> 93 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="even"><td class="first-col"> 13 </td><td> 100 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="odd"><td class="first-col"> 14 </td><td> 108 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="even"><td class="first-col"> 15 </td><td> 116 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="odd"><td class="first-col"> 16 </td><td> 123.1 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="even"><td class="first-col"> 17 </td><td> 131 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="odd"><td class="first-col"> 18 </td><td> 138.5 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="even"><td class="first-col"> 19 </td><td> 146.5 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="odd"><td class="first-col"> 20 </td><td> 153.9 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="even"><td class="first-col"> 21 </td><td> 161.6 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="odd"><td class="first-col"> 22 </td><td> 167 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="even"><td class="first-col"> 23 </td><td> 174 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="odd"><td class="first-col"> 24 </td><td> 182 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="even"><td class="first-col"> 25 </td><td> 189 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <tr class="odd"><td class="first-col"> 26 </td><td> 197 </td></tr>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <h2 id="family">Font-family Adjustment</h2>
4cfd7ba7bf329b560b02ffe377b88b693c2651f2Matt Sweeney <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>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney#demo2 {font-family:monospace;}
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney#demo3 {font-family:georgia;}
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney#demo4 {font-family:verdana;}
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney#demo5 {font-family:times;}
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <h3 id="start-contextually">Using CSS Fonts In Specific Contexts</h3>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <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><HTML&ht;</code> element directly.</p>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <p>The following code snippet show how you might apply CSS Fonts to one of two columns:</p>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <div class="yui3-cssfonts"><h1>Lorem Ipsum</h1></div>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <div><h1>Lorem Ipsum</h1></div>
7b8680288e79cc11a4c20b66ce5c167619f1431fMatt Sweeney <p>Here is an example showing how to <a href="cssfonts-context.html">apply CSS Fonts to a subset of a page</a>.</p>