<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Antártico Norte &#187; fuentes</title>
	<atom:link href="http://antarticonorte.com/blog/tag/fuentes/feed/" rel="self" type="application/rss+xml" />
	<link>http://antarticonorte.com/blog</link>
	<description>Fotografía, diseño web y de todo un poco</description>
	<lastBuildDate>Tue, 19 Jan 2010 19:20:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Fuentes relativas en CSS</title>
		<link>http://antarticonorte.com/blog/2008/09/24/fuentes-relativas-en-css/</link>
		<comments>http://antarticonorte.com/blog/2008/09/24/fuentes-relativas-en-css/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 21:00:49 +0000</pubDate>
		<dc:creator>Al-x</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[fuentes]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[ie]]></category>

		<guid isPermaLink="false">http://antarticonorte.com/?p=42</guid>
		<description><![CDATA[En algún momento de nuestra carrera profesional, todos nosotros hemos oído o leido que debemos usar tamaños de fuentes relativos (si no es el caso, te lo digo yo: debes usar tamaños de fuentes relativos).
¿Por qué debo yo usar fuentes relativos?
Simple: por usabilidad.

Como diseñadores, tenemos que dar al usuario la posibilidad de usar el tamaño [...]]]></description>
			<content:encoded><![CDATA[<p>En algún momento de nuestra carrera profesional, todos nosotros hemos oído o leido que debemos usar tamaños de fuentes relativos (si no es el caso, te lo digo yo: debes usar tamaños de fuentes relativos).</p>
<h3>¿Por qué debo yo usar fuentes relativos?</h3>
<p>Simple: por usabilidad.</p>
<p><span id="more-42"></span></p>
<p>Como diseñadores, tenemos que dar al usuario la posibilidad de usar el tamaño de fuente que ellos quieran. Usando un tamaño de fuente absoluto estamos quitando esta opción a los usuarios, a muchos usuarios (los que usan ese <em title="Internet explorer">gran amigo</em> de los diseñadores y desarrolladores web).</p>
<p>Cojamos una web cualquiera al azar, como por ejemplo <a href="http://www.elpais.com">elpais.com</a>.</p>
<p><img src="http://antarticonorte.com/blog/wp-content/uploads/2008/09/imagen-1.png" alt="" title="elpais.com tamaño de fuente medio" /></p>
<p>Ahora ir al menú Ver &gt; Tamaño de fuente &gt; La más grande.</p>
<p><a href="http://antarticonorte.com/blog/wp-content/uploads/2008/09/menu-ie.png"><img src="http://antarticonorte.com/blog/wp-content/uploads/2008/09/menu-ie.png" alt="" title="menu-ie" class="boxed" /></a></p>
<p>Y podemos ver como el texto no cambia, tiene el mismo tamaño:</p>
<p><img src="http://antarticonorte.com/blog/wp-content/uploads/2008/09/imagen-1.png" alt="" title="elpais.com tamaño de fuente más grande." /></p>
<h3>Cómo usar fuentes relativas</h3>
<p>Para poder usar tamaños relativos de fuente, debemos partir de la base de que casi todos los navegadores tienen un tamaño estándar de 16px. Sabiendo esto sólo tenemos que hacer algo de matemáticas y usar <em>em</em> como unidad para las fuentes.</p>
<p>Por definición, 1em equivale al tamaño de fuente que estemos utilizando (en nuestro caso 16px). Así 2em equivalen a 32px y 0.5em a 8px.</p>
<p>Si queremos que el tamaño de todos los <code>&ld;p /&gt;</code> de nuestra página tengan un tamaño de fuente de 12px, tendremos que usar el siguiente CSS</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">.75em</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Calcular el tamaño de todos los elementos puede ser una tarea tediosa (y odiosa). Podemos simplificarlo cambiando el tamaño de fuente del documento a 10px de forma que las conversiones sean más directas (1em = 10px, 1.2em = 12px, &#8230;)</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">html <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;"><span style="color: #cc66cc;">62.5</span>%</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span> <span style="color: #808080; font-style: italic;">/* 10/16 = 0.625. Usamos porcentajes por que hay navegadores que discriminan el tercer decimal */</span>
p <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">1.2em</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<h3>Mas allá: unidades relativas para las medidas</h3>
<p>Podemos hacer que el <em>layout</em> de la página se adapte al tamaño de fuente del usuario usando unidades relativas para los anchos. Como hemos establecido un tamaño base de 10px la conversión es directa.</p>
<p>Supongamos el siguiente layout:</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;container&quot;&gt;
	&lt;div class=&quot;col1&quot;&gt;&lt;h2&gt;lorem ipsum dolor sit amet&lt;/h2&gt;&lt;/div&gt;
	&lt;div class=&quot;col2&quot;&gt;&lt;h2&gt;consequecter adipliscing elit&lt;/h2&gt;&lt;/div&gt;
	&lt;div style=&quot;clear:both;&quot;&gt;&lt;/div&gt;
&lt;/div&gt;</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.container</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.col1</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.col2</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">200px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
h2 <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span><span style="color: #933;">2em</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Si aumentamos el tamaño de la fuente con el navegador, llegará un momento en el que el texto no entre en las columnas y se solapen. Sin embargo, si utilizamos el siguiente CSS</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #6666ff;">.container</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">30em</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.col1</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">10em</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.col2</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">20em</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Al aumentar el tamaño de la fuente, aumentará de forma proporcional el ancho de las columnas, por lo que nunca se llegará a solapar el texto de una sobre el de otra.</p>
]]></content:encoded>
			<wfw:commentRss>http://antarticonorte.com/blog/2008/09/24/fuentes-relativas-en-css/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

