<?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; css</title>
	<atom:link href="http://antarticonorte.com/blog/tag/css/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>Usando LESS con Nanoc</title>
		<link>http://antarticonorte.com/blog/2010/01/19/usando-less-con-nanoc/</link>
		<comments>http://antarticonorte.com/blog/2010/01/19/usando-less-con-nanoc/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 19:20:20 +0000</pubDate>
		<dc:creator>Al-x</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[less]]></category>
		<category><![CDATA[nanoc]]></category>

		<guid isPermaLink="false">http://antarticonorte.com/blog/?p=215</guid>
		<description><![CDATA[ En el articulo anterior vimos como crear un sitio web básico con nanoc. Ahora vamos a ver como podemos gestionar nuestras hojas de estilo en un proyecto de nanoc utilizando LESS.
LESS, o &#8220;Leaner CSS&#8221; es una gema de Ruby que extiende el lenguaje CSS con elementos propios de otros lenguajes de programación, como variables, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://antarticonorte.com/blog/wp-content/uploads/2010/01/less.png" alt="" title="less" width="214" height="114" class="alignright size-full wp-image-216" /> En el articulo anterior vimos como <a href="http://antarticonorte.com/blog/2010/01/09/empezando-con-nanoc/">crear un sitio web básico con nanoc</a>. Ahora vamos a ver como podemos gestionar nuestras hojas de estilo en un proyecto de nanoc utilizando <a href="http://lesscss.org/">LESS</a>.</p>
<p>LESS, o &#8220;Leaner CSS&#8221; es una gema de Ruby que extiende el lenguaje CSS con elementos propios de otros lenguajes de programación, como variables, herencia, operaciones aritméticas, etc. Algunas de las cosas que nos permite son:</p>
<p><strong>Variables</strong><br />
LESS te permite declarar variables y reutilizarlas dentro de tus hojas de estilo, haciendo cambios globales tan sencillos como modificar una linea.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #a1a100;">@color_logo: #F7BD01;</span>
&nbsp;
<span style="color: #cc00cc;">#logo</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #a1a100;">@color_logo; }</span></pre></div></div>

<p><strong>Elementos anidados (herencia)</strong><br />
Con LESS, en vez de tener selectores largos podemos anidar un selector dentro de otro. De esta forma la herencia queda más clara y tus hojas de estilo más pequeñas.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">/* less */</span>
<span style="color: #cc00cc;">#cabecera</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#222</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">;</span>
    a <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
    <span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/* css */</span>
<span style="color: #cc00cc;">#cabecera</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#222</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#cabecera</span> a <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span><span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>No voy a hablar mucho más de LESS en este articulo. Para ver más características os recomiendo que leais la <a href="http://lesscss.org/docs.html">documentación oficial</a>, donde explican cómo extiende el lenguaje CSS y todo lo que se puede hacer con la librería.</p>
<p><span id="more-215"></span></p>
<h3>Instalando LESS</h3>
<p>Instalar LESS es tan sencillo como instalar cualquier otra gema de Ruby. Basta con abrir una sesión de terminal y ejecutar:</p>
<pre class="term">
$ sudo gem install less
</pre>
<h3>Integrar LESS con Nanoc</h3>
<p>Lo primero que necesitas es un proyecto de nanoc. Si seguiste el <a href="http://antarticonorte.com/blog/2010/01/09/empezando-con-nanoc/">anterior articulo</a> ya deberías de tener un proyecto, si no es así, leetelo y empieza a usar esta maravillosa herramienta.</p>
<p>Vete al directorio donde tengas tu proyecto de nanoc y crea un nuevo item. Para mantener las cosas organizadas, los items que sean hojas de estilo los vamos a crear dentro del directorio <code>css</code>.</p>
<pre class="term">
$ cd code/mi_sitio
$ nanoc3 create_item css/estilos
      create  content/css/estilos.yaml
      create  content/css/estilos.html
</pre>
<p>Fíjate en que no he escrito la extensión del fichero, y que nanoc ha supuesto automáticamente que quiero crear una página <code>.html</code>. Bueno, no hay forma de decirle que extensión queremos usar, por lo que la única solución es renombrar a posteriori el fichero. Los las hojas de estilo de LESS llevan la extensión .less</p>
<pre class="term">
$ mv content/css/estilos.html content/css/estilos.less
</pre>
<p>Ahora tenemos que decir a nanoc como tiene que compilar nuestras hojas de estilo. Para ello tenemos que modificar el fichero <code>Rules</code> de la raíz de nuestro proyecto y añadir lo siguiente al principio del todo.</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># Stylesheets</span>
route <span style="color:#996600;">'/css/*'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  item.<span style="color:#9900CC;">identifier</span>.<span style="color:#CC0066; font-weight:bold;">chop</span> <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#996600;">'.css'</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
compile <span style="color:#996600;">'/css/*'</span> <span style="color:#9966CC; font-weight:bold;">do</span>
  filter <span style="color:#ff3333; font-weight:bold;">:less</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>No entraré en detalles, pero el código que hemos añadido en el fichero le dice a nanoc tres cosas: donde tiene que guardar nuestras hojas de estilo, con que nombre, y qué filtro debe utilizar para ello.</p>
<p>Para comprobar que funciona vamos a crear una hoja de estilo con LESS muy sencilla.</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Georgia<span style="color: #00AA00;">,</span> Palatino<span style="color: #00AA00;">,</span> Times<span style="color: #00AA00;">,</span> <span style="color: #ff0000;">'Times New Roman'</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
body <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
a <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
    <span style="color: #3333ff;">:link</span><span style="color: #00AA00;">,</span> <span style="color: #3333ff;">:visited </span><span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#f30</span><span style="color: #00AA00;">;</span>
    <span style="color: #00AA00;">&#125;</span>
    <span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#f90</span><span style="color: #00AA00;">;</span>
    <span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#main</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">40px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">280px</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">500px</span><span style="color: #00AA00;">;</span>
&nbsp;
    h1 <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;">40px</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">normal</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">40px</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">letter-spacing</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-1px</span><span style="color: #00AA00;">;</span>
    <span style="color: #00AA00;">&#125;</span>
    p <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
    <span style="color: #00AA00;">&#125;</span>
    ul <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
    <span style="color: #00AA00;">&#125;</span>
    li <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">list-style-type</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">square</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
    <span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#sidebar</span> <span style="color: #00AA00;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">40px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</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: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span> <span style="color: #933;">20px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">border-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">;</span>
    <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span>
    h2 <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">text-transform</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">uppercase</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">13px</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#333</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">letter-spacing</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
    <span style="color: #00AA00;">&#125;</span>
    ul <span style="color: #00AA00;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">list-style-type</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
    <span style="color: #00AA00;">&#125;</span>
    li <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;">14px</span><span style="color: #00AA00;">;</span>
        <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
    <span style="color: #00AA00;">&#125;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Como puedes ver estamos haciendo uso de los selectores anidados de LESS para dejar la hoja de estilo más limpia.</p>
<p>Para comprobar que los cambios han surtido efecto vamos a arrancar el autocompilador de nanoc. Para ello ejecutamos:</p>
<pre class="term">
$ nanoc3 aco
</pre>
<p>Si ahora abrimos un navegador y pedimos la URL http://localhost:3000/css/estilos.css, deberíamos de ver la hoja de estilos procesada con LESS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
  <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Georgia<span style="color: #00AA00;">,</span> Palatino<span style="color: #00AA00;">,</span> Times<span style="color: #00AA00;">,</span> <span style="color: #ff0000;">'Times New Roman'</span><span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
body <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ffffff</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
a <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
a<span style="color: #3333ff;">:link </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ff3300</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
a<span style="color: #3333ff;">:visited </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ff3300</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ff9900</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
...</pre></div></div>

<p>Utilizar la nueva hoja de estilo ya procesada es tan fácil como añadir un <code>&lt;link /&gt;</code> a tu fichero de layout. Para ello modificamos el fichero &#8220;layouts/default.html&#8221;, buscamos la siguiente linea:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;/style.css&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;screen&quot;</span>&gt;</span></pre></div></div>

<p>y la cambiamos por esta otra:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">link</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;/css/estilos.css&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;screen&quot;</span>&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://antarticonorte.com/blog/2010/01/19/usando-less-con-nanoc/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<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>
		<item>
		<title>PNGs transparentes en nuestros CSS para Internet Explorer</title>
		<link>http://antarticonorte.com/blog/2008/01/30/pngs-transparentes-en-nuestros-css-para-internet-explorer/</link>
		<comments>http://antarticonorte.com/blog/2008/01/30/pngs-transparentes-en-nuestros-css-para-internet-explorer/#comments</comments>
		<pubDate>Wed, 30 Jan 2008 22:54:46 +0000</pubDate>
		<dc:creator>Al-x</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[ie]]></category>
		<category><![CDATA[png]]></category>

		<guid isPermaLink="false">http://antarticonorte.com/2008/01/30/pngs-transparentes-en-nuestros-css-para-internet-explorer/</guid>
		<description><![CDATA[Que levanten la mano todos los que han querido meter una caja en su web con un fondo translucido y no han podido por culpa de Internet Explorer.
Hasta su versión 7, Internet Explorer no soporta el uso de PNGs transparentes de modo nativo. Sin embargo es posible usar un PNG transparente en nuestras hojas de [...]]]></description>
			<content:encoded><![CDATA[<p>Que levanten la mano todos los que han querido meter una caja en su web con un fondo translucido y no han podido por culpa de Internet Explorer.</p>
<p>Hasta su versión 7, Internet Explorer no soporta el uso de PNGs transparentes de modo nativo. Sin embargo es posible usar un PNG transparente en nuestras hojas de estilos usando un filtro propietario. Nos interesa que dicho filtro solo lo interprete Internet Explorer 6 e inferiores, por lo que tendremos que utilizar comentarios condicionales o algún otro método para filtrar CSS. (Yo personalmente uso el <a href="http://www.google.com/search?hl=es&#038;rls=es-es&#038;q=tan+hack&#038;btnG=Buscar&#038;lr=">Tan hack</a>)</p>
<pre class="css">
.capa-con-png {
	background:url(&#x27;../img/transparente.png&#x27;);
}
* html .capa-con-png {
	background-image: none; /* Sin esto no veríamos la imagen cargada con el filtro */
	filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=&#x27;img/transparente.png&#x27;, sizingMethod=&#x27;scale&#x27;);
}
</pre>
<h3>A tener en cuenta</h3>
<p>Es más que posible que en nuestro sitio la estructura de carpetas sea similar a la de la imagen, y que en nuestra hoja de estilos estemos poniendo las rutas relativas como en el ejemplo de arriba. Es importante saber que en el filtro las rutas no se tienen en cuenta desde el CSS, sino desde <strong>la página en la que estemos</strong>. Para ahorrarnos problemas es mejor usar rutas absolutas (siempre que tengamos posibilidad).</p>
<p>Las imagenes cargadas con el filtro no aceptan las propiedades <code>background-position</code> y <code>background-repeat</code>. Siempre se posicionarán en la esquina superior izquierda y se repetirán una única vez.</p>
<p>Dentro del filtro, la propiedad <code>sizingMethod</code> acepta dos valores:</p>
<ul>
<li><strong>image</strong>: pondrá la imagen a su tamaño. Si tenemos un PNG de 1&#215;1 pixels, lo mostrará a 1&#215;1.</li>
<li><strong>scale</strong>: redimesiona la imagen al tamaño de la caja en la que estamos aplicando el filtro. Si tenemos un png de 100&#215;100 pixels puesto en una caja que mide 200&#215;400 px, lo reescalará hasta ocupar toda la página</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://antarticonorte.com/blog/2008/01/30/pngs-transparentes-en-nuestros-css-para-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
