src/cm/media/js/lib/yui/yui_3.10.3/docs/cssfonts/index.html
author Yves-Marie Haussonne <ymh.work+github@gmail.com>
Fri, 09 May 2014 18:35:26 +0200
changeset 656 a84519031134
parent 525 89ef5ed3c48b
permissions -rw-r--r--
add link to "privacy policy" in the header test

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>CSS Fonts</title>
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic,700italic">
    <link rel="stylesheet" href="../../build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/css/main.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="shortcut icon" type="image/png" href="../assets/favicon.png">
    <script src="../../build/yui/yui-min.js"></script>
    
</head>
<body>
<!--
<a href="https://github.com/yui/yui3"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
-->
<div id="doc">
    <div id="hd">
        <h1><img src="http://yuilibrary.com/img/yui-logo.png"></h1>
    </div>
    
        <a href="#toc" class="jump">Jump to Table of Contents</a>
    

            <h1>CSS Fonts</h1>
    <div class="yui3-g">
        <div class="yui3-u-3-4">
            <div id="main">
                <div class="content">				<div class="intro">
                    <p class="deprecated"><em>
<strong>Note:</strong> The files "fonts.css" and "fonts-context.css" are deprecated, use "cssfonts.css" and
"cssfonts-context.css" instead.</em></p>
                					
					<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>
										
					<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>						
                </div>
							
				<h2 id="start">Getting Started</h2>

				<h3 id="dependencies">Include Dependencies</h3>
				
				<p>To use CSS Fonts, include the following source file in your web page with the link element:</p>

<pre class="code prettyprint">&lt;link rel=&quot;stylesheet&quot; type=&quot;text&#x2F;css&quot; href=&quot;http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.10.3&#x2F;build&#x2F;cssfonts&#x2F;cssfonts-min.css&quot;&gt;</pre>

				
				<h3 id="context">Global vs. Contextual</h3>
				
				<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>
				
				<p>Here is how to include the contextual version of CSS Fonts:</p> 

<pre class="code prettyprint">&lt;!-- Source File --&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text&#x2F;css&quot; href=&quot;http:&#x2F;&#x2F;yui.yahooapis.com&#x2F;3.10.3&#x2F;build&#x2F;cssfonts&#x2F;cssfonts-context-min.css&quot;&gt;</pre>

				<h2 id="using">Using CSS Fonts</h2>

				<h3 id="default">Default Text</h3>

				<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>

				<h3 id="fontsize">Font-size Adjustment</h3>

				<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>

<pre class="code prettyprint">#demo1 {font-size:85%;}  &#x2F;*renders 11px *&#x2F;
#demo2 {font-size:100%;} &#x2F;*renders 13px *&#x2F; 
#demo3 {font-size:108%;} &#x2F;*renders 14px *&#x2F;
#demo4 {font-size:123.1%;} &#x2F;*renders 16px *&#x2F;
#demo5 {font-size:138.5%;} &#x2F;*renders 18px *&#x2F;</pre>


				<div id="fontsize-chart">
					<table border="1" cellpadding="3" cellspacing="3" class="auto">
						<tr>
							<th class="first-col">For pixels (px)</th>
							<th>Declare this percent (%)</th>
						</tr>
						<tr class="odd"><td class="first-col"> 10 </td><td> 77</td></tr>
						<tr class="even"><td class="first-col"> 11 </td><td> 85 </td></tr>
						<tr class="odd"><td class="first-col"> 12 </td><td> 93 </td></tr>
						<tr class="even"><td class="first-col"> 13 </td><td> 100 </td></tr>
						<tr class="odd"><td class="first-col"> 14 </td><td> 108 </td></tr>
						<tr class="even"><td class="first-col"> 15 </td><td> 116 </td></tr>
						<tr class="odd"><td class="first-col"> 16 </td><td> 123.1 </td></tr>
						<tr class="even"><td class="first-col"> 17 </td><td> 131 </td></tr>
						<tr class="odd"><td class="first-col"> 18 </td><td> 138.5 </td></tr>
						<tr class="even"><td class="first-col"> 19 </td><td> 146.5 </td></tr>
						<tr class="odd"><td class="first-col"> 20 </td><td> 153.9 </td></tr>
						<tr class="even"><td class="first-col"> 21 </td><td> 161.6 </td></tr>
						<tr class="odd"><td class="first-col"> 22 </td><td> 167 </td></tr>
						<tr class="even"><td class="first-col"> 23 </td><td> 174 </td></tr>
						<tr class="odd"><td class="first-col"> 24 </td><td> 182 </td></tr>
						<tr class="even"><td class="first-col"> 25 </td><td> 189 </td></tr>
						<tr class="odd"><td class="first-col"> 26 </td><td> 197 </td></tr>
					</table>
				</div>

				<h2 id="family">Font-family Adjustment</h2>
				<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>

<pre class="code prettyprint">#demo1 {}
#demo2 {font-family:monospace;}
#demo3 {font-family:georgia;}
#demo4 {font-family:verdana;}
#demo5 {font-family:times;}</pre>

				
				<h3 id="start-contextually">Using CSS Fonts In Specific Contexts</h3>				
		
				<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&gt;</code> element directly.</p>
				
				<p>The following code snippet show how you might apply CSS Fonts to one of two columns:</p>
					
<pre class="code prettyprint">&lt;div&gt;
	&lt;div class=&quot;yui3-cssfonts&quot;&gt;&lt;h1&gt;Lorem Ipsum&lt;&#x2F;h1&gt;&lt;&#x2F;div&gt;
	&lt;div&gt;&lt;h1&gt;Lorem Ipsum&lt;&#x2F;h1&gt;&lt;&#x2F;div&gt;
&lt;&#x2F;div&gt;</pre>


	<p>Here is an example showing how to <a href="cssfonts-context.html">apply CSS Fonts to a subset of a page</a>.</p>
</div>
            </div>
        </div>

        <div class="yui3-u-1-4">
            <div class="sidebar">
                
                    <div id="toc" class="sidebox">
                        <div class="hd">
                            <h2 class="no-toc">Table of Contents</h2>
                        </div>

                        <div class="bd">
                            <ul class="toc">
<li>
<a href="#start">Getting Started</a>
<ul class="toc">
<li>
<a href="#dependencies">Include Dependencies</a>
</li>
<li>
<a href="#context">Global vs. Contextual</a>
</li>
</ul>
</li>
<li>
<a href="#using">Using CSS Fonts</a>
<ul class="toc">
<li>
<a href="#default">Default Text</a>
</li>
<li>
<a href="#fontsize">Font-size Adjustment</a>
</li>
</ul>
</li>
<li>
<a href="#family">Font-family Adjustment</a>
<ul class="toc">
<li>
<a href="#start-contextually">Using CSS Fonts In Specific Contexts</a>
</li>
</ul>
</li>
</ul>
                        </div>
                    </div>
                

                
                    <div class="sidebox">
                        <div class="hd">
                            <h2 class="no-toc">Examples</h2>
                        </div>

                        <div class="bd">
                            <ul class="examples">
                                
                                    
                                        <li data-description="When CSS Fonts is included in a page, it applies a baseline font treatment to all HTML elements. This baseline is Arial at the equivalent of 13px size and 16px line-height.">
                                            <a href="cssfonts-basic.html">Global (Page-Level) Example</a>
                                        </li>
                                    
                                
                                    
                                        <li data-description="Use the alternate contextual version of YUI Fonts to have precise control over which regions of the page are targeted.">
                                            <a href="cssfonts-context.html">Contextual Example</a>
                                        </li>
                                    
                                
                                    
                                        <li data-description="Define all non-baseline sizes in percentages when using YUI Fonts.">
                                            <a href="cssfonts-size.html">Setting Font Size</a>
                                        </li>
                                    
                                
                            </ul>
                        </div>
                    </div>
                

                
            </div>
        </div>
    </div>
</div>

<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>

<script>
YUI.Env.Tests = {
    examples: [],
    project: '../assets',
    assets: '../assets/cssfonts',
    name: 'cssfonts',
    title: 'CSS Fonts',
    newWindow: '',
    auto:  false 
};
YUI.Env.Tests.examples.push('cssfonts-basic');
YUI.Env.Tests.examples.push('cssfonts-context');
YUI.Env.Tests.examples.push('cssfonts-size');

</script>
<script src="../assets/yui/test-runner.js"></script>



</body>
</html>