<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>CSS-Tricks</title>
	
	<link>http://css-tricks.com</link>
	<description>Tips, Tricks, and Techniques on using Cascading Style Sheets.</description>
	<lastBuildDate>Fri, 25 May 2012 02:48:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="csstricks" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">CssTricks</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Css-tricks" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="css-tricks" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>HTML for Icon Font Usage</title>
		<link>http://css-tricks.com/html-for-icon-font-usage/</link>
		<comments>http://css-tricks.com/html-for-icon-font-usage/#comments</comments>
		<pubDate>Thu, 24 May 2012 16:02:46 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[Intermediate]]></category>

		<guid isPermaLink="false">http://css-tricks.com/?p=17028</guid>
		<description><![CDATA[<p><p>Where are we at right now in terms of the best markup for using icon fonts? Let's cover some options I think are currently the best.</p>
<p></p>
<ol>
<li>You want the icon to enhance a word</li>
<li>You want the icon to stand alone but still be functional or informational</li>
</ol>
<p>And our major goals here are:</p>
<ol>
<li>As good of semantics as we can get</li>
<li>As little awkwardness for screen readers as possible</li>
</ol>
<p>This ground has <a href="http://yatil.net/a-better-way-to-use-icon-fonts">been</a> <a href="http://24ways.org/2011/displaying-icons-with-fonts-and-data-attributes">treaded</a> <a href="http://filamentgroup.com/lab/dingbat_webfonts_accessibility_issues/">before</a>, but I think the &#8230;</p></p><p><a href="http://css-tricks.com/html-for-icon-font-usage/">HTML for Icon Font Usage</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></description>
			<content:encoded><![CDATA[<p>Where are we at right now in terms of the best markup for using icon fonts? Let's cover some options I think are currently the best.</p>
<p><span id="more-17028"></span></p>
<ol>
<li>You want the icon to enhance a word</li>
<li>You want the icon to stand alone but still be functional or informational</li>
</ol>
<p>And our major goals here are:</p>
<ol>
<li>As good of semantics as we can get</li>
<li>As little awkwardness for screen readers as possible</li>
</ol>
<p>This ground has <a href="http://yatil.net/a-better-way-to-use-icon-fonts">been</a> <a href="http://24ways.org/2011/displaying-icons-with-fonts-and-data-attributes">treaded</a> <a href="http://filamentgroup.com/lab/dingbat_webfonts_accessibility_issues/">before</a>, but I think the following techniques are a small step forward.</p>
<h3 id="jump-enhance">Enhancing a word</h3>
<p>Let's say we have a header like "Stats" and we want to set it apart from other headers on the page and emphasize it's meaning. Semantic ideal:</p>
<pre rel="HTML"><code>&lt;h2 id="stats" class="stats-title"&gt;Stats&lt;/h2&gt;</code></pre>
<p>Result:</p>
<figure><img src="http://cdn.css-tricks.com/wp-content/uploads/2012/05/stats.png" alt="" title="stats" width="147" height="50" class="alignnone size-full wp-image-17029" /></figure>
<p>So to get that icon in there (remember we're talking <em>font</em> icons here, we can't just pad the left and use a background) we'll need to insert some content. </p>
<p>Using a pseudo element is tempting because 1) they aren't read by most screen readers 2) we don't need dedicated markup for the icon which is a semantic ideal. Unfortunately, VoiceOver on OS X <em>does</em> read the content of pseudo elements. (<a href="http://www.456bereastreet.com/archive/201205/css_generated_content_and_screen_readers/">reference 1</a>, <a href="http://cssgallery.info/testing-the-accessibility-of-the-css-generated-content/">reference 2</a>) Well, perhaps "fortunately" as if I'm reading <a href="http://www.w3.org/WAI.new/PF/aria/complete#namecalculation">the spec</a> correctly that's what it is supposed to do. Psuedo elements just aren't in the DOM and thus that probably makes it harder for third-party apps to do.</p>
<p>The good news is that if we use a bit of markup, we can use <a href="http://www.w3.org/TR/wai-aria/states_and_properties#aria-hidden">aria-hidden</a> attribute to prevent it from being spoken. </p>
<p>One more dash of bad news, even with <code>aria-hidden</code> on the markup surrounding the icon, VoiceOver on OS X will announce "HTML Content" when in focus. #dammit. </p>
<p>But alas! We can still win here. If we combine the markup technique and pseudo element technique, we can insert the icon with no VoiceOver weirdness. And as a double-win freebie, this combined technique is ideal for keeping our CSS lean and mean as it requires no class-name-bloat and works well with the next use case we need to cover. </p>
<p>So the final markup for this becomes:</p>
<pre rel="HTML"><code>&lt;h2 id="stats"&gt;
  &lt;span aria-hidden="true" data-icon="&amp;#x21dd;"&gt;&lt;/span&gt;
  Stats
&lt;/h2&gt;</code></pre>
<p>And the CSS is:</p>
<pre rel="CSS"><code>[data-icon]:before {
  font-family: icons; /* BYO icon font, mapped smartly */
  content: attr(data-icon);
  speak: none; /* Not to be trusted, but hey. */
}</code></pre>
<p>Holy cow that's easy eh? Notice we aren't using a specific class name for the icon (e.g. like .icon-stats or something), we're using a <code>data-*</code> attribute to hold exactly which character we want to insert. In our icon font, we map those special characters to the icon we want to use. I find this perfectly semantic and even future proof (you could always select uniquely down the line even if you change the character). But if you prefer class names, more power to you, that's fine and doesn't change this technique drastically. </p>
<p>We'll cover mapping characters at the end.</p>
<h3 id="jump-alone">Stand-Alone Icons</h3>
<p>Say we have an icon that is a link or in some way functional, but it isn't accompanied by any text. For instance, a shopping cart icon that you can click to go to your shopping cart. Hopefully that functionality is obvious visually, with some kind of rollover state or general design obviousness. But that functionality also needs to be audibly obvious.</p>
<p>Instead of crafting a totally new technique to deal with this (which I've dabbled with in the past) let's lean on what we've already started. A span that inserts the character with a pseudo element, and text that sits right next to it that we kick off the page visually.</p>
<pre rel="HTML"><code>&lt;a href="#rss" class="icon-alone"&gt;
  &lt;span aria-hidden="true" data-icon="&amp;#x25a8;"&gt;&lt;/span&gt;
  &lt;span class="screen-reader-text"&gt;RSS&lt;/span&gt;
&lt;/a&gt;</code></pre>
<p>We need very little in additional CSS, just a little usability fix applied via class, and a toolbox class for hiding the text but leaving it accessible.</p>
<pre rel="CSS"><code>.icon-alone {
  display: inline-block; /* Fix for clickability issue in WebKit */
}
.screen-reader-text { /* Reusable, toolbox kind of class */
  position: absolute;
  top: -9999px;
  left: -9999px;
}</code></pre>
<h3>Hey, it works</h3>
<p><iframe width="640" height="360" src="http://www.youtube.com/embed/1JnrmmcoLSM" frameborder="0" allowfullscreen></iframe></p>
<p><a class="button" href="http://css-tricks.com/examples/IconFont/">View Demo</a></p>
<p>In VoiceOver, anyway. Would be great to hear from people who use other screen readers how this holds up. </p>
<h3>Building / Mapping Your Icon Font</h3>
<p>One "issue" in the world of icon fonts right now is that the majority of them available come pre-mapped to letters. Used with improper markup, the letters become "content" and a part of the semantics of the document. Or worse, read outloud by screen readers. </p>
<p>It almost never makes sense for an icon to be mapped to a letter. Instead, I recommend mapping icons to the closest unicode symbol you can find. For instance, mapping a heart icon to ❤ is a splendid idea. The meaning of symbols is rather relative anyway, so close counts and will be a semantic improvement immediately. </p>
<p>Even better, I like the idea of mapping icons to the <a href="http://en.wikipedia.org/wiki/Private_Use_(Unicode)#Private_Use_Areas">"Private Use Area"</a> of Unicode. As I understand it, this is exactly why it exists, to use for your own special characters. Mapped this way, you're in no danger of the character being spoken by a screen reader. <del>Unfortunately at the time of this writing icons mapped this way don't work in even the latest Safari, so it's not yet recommended.</del> <ins>Here's the scoop on the Private Use Area issues paraphrased from Keyamoon:</ins></p>
<p>There is a difference between PUA (Private Use Area) and SPUA (Supplementary Private Use Area). The difference is explained a bit <a href="http://en.wikipedia.org/wiki/Private_Use_(Unicode)#Private_Use_Areas">here</a>. In my testing, PUA mapping works perfectly in all browsers. SPUA mapping borks in Safari only on Windows. The IcoMoon app only maps to PUA, which is recommendable at least for the short term future.</p>
<p>Here are the steps to follow:</p>
<ol>
<li><a href="http://css-tricks.com/flat-icons-icon-fonts/">Pick out an icon font</a>.</li>
<li>Go to <a href="http://keyamoon.com/icomoon/">IcoMoon</a> and load it up (or use their icon set)</li>
<li>Choose the icons you want.<br />
<figure>
<img src="http://cdn.css-tricks.com/wp-content/uploads/2012/05/icomoon-1.jpg" alt="" title="icomoon-1" width="1249" height="722" class="alignnone size-full wp-image-17049" /><br />
</figure>
</li>
<li>Map them to the characters you want. Best to map to a relavant symbol or PUA.<br />
<figure><img src="http://cdn.css-tricks.com/wp-content/uploads/2012/05/icomoon-2.jpg" alt="" title="icomoon-2" width="1236" height="721" class="alignnone size-full wp-image-17050" /></figure>
</li>
<li>Download the fonts/demo.</li>
</ol>
<p>You can also use <a href="http://pictos.cc/server/">Pictos Server</a> to do the icon-picking and mapping, but it only works with Pictos and doesn't help you with choose symbols (you could copy and paste from here). It is a very nice set though and hosts for you and makes it very easy to existing sets without manually swapping out font files.</p>
<h3>The Future</h3>
<p>In the future, hopefully we can rely on <code>speak: none;</code> working perfectly everywhere so we can go back to using pseudo elements and perfect semantics.</p>
<p><a href="http://css-tricks.com/html-for-icon-font-usage/">HTML for Icon Font Usage</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></content:encoded>
			<wfw:commentRss>http://css-tricks.com/html-for-icon-font-usage/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>WordPress Meet Responsive Design</title>
		<link>http://build.codepoet.com/2012/05/11/wordpress-meet-responsive-design/</link>
		<comments>http://css-tricks.com/wordpress-meet-responsive-design/#comments</comments>
		<pubDate>Wed, 23 May 2012 03:54:48 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[Link]]></category>

		<guid isPermaLink="false">http://css-tricks.com/?p=17042</guid>
		<description><![CDATA[<p><p>Ian Stewart, Sara Cannon and I are featured in this lovely little (free) book on Responsive Web Design and WordPress. It's a part of the new Code Poet, a new thingy by Automattic full of high quality resources on WordPress development.</p>
<p><a href="http://build.codepoet.com/2012/05/11/wordpress-meet-responsive-design/" title="Direct link to featured article">Direct Link to Article</a> &#8212; <a href="http://css-tricks.com/wordpress-meet-responsive-design/">Permalink</a>&#8230;</p></p><p><a href="http://css-tricks.com/wordpress-meet-responsive-design/">WordPress Meet Responsive Design</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></description>
			<content:encoded><![CDATA[<p>Ian Stewart, Sara Cannon and I are featured in this lovely little (free) book on Responsive Web Design and WordPress. It's a part of the new Code Poet, a new thingy by Automattic full of high quality resources on WordPress development.</p>
<p><a href="http://build.codepoet.com/2012/05/11/wordpress-meet-responsive-design/" title="Direct link to featured article">Direct Link to Article</a> &#8212; <a href="http://css-tricks.com/wordpress-meet-responsive-design/">Permalink</a></p><p><a href="http://css-tricks.com/wordpress-meet-responsive-design/">WordPress Meet Responsive Design</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></content:encoded>
			<wfw:commentRss>http://css-tricks.com/wordpress-meet-responsive-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The real conflict behind &lt;picture&gt; and @srcset</title>
		<link>http://blog.cloudfour.com/the-real-conflict-behind-picture-and-srcset/</link>
		<comments>http://css-tricks.com/the-real-conflict-behind-picture-and-srcset/#comments</comments>
		<pubDate>Wed, 23 May 2012 03:09:50 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[Link]]></category>

		<guid isPermaLink="false">http://css-tricks.com/?p=17040</guid>
		<description><![CDATA[<p><p>Jason Grigsby explains it. Essentially: Browsers use a "pre-parser" to find resources in a document it will later need. This plays a huge role in making them fast. It can't wait around for layout information, which is exactly what responsive images need to make a smart call.</p>
<p><a href="http://blog.cloudfour.com/the-real-conflict-behind-picture-and-srcset/" title="Direct link to featured article">Direct Link to Article</a> &#8212; <a href="http://css-tricks.com/the-real-conflict-behind-picture-and-srcset/">Permalink</a>&#8230;</p></p><p><a href="http://css-tricks.com/the-real-conflict-behind-picture-and-srcset/">The real conflict behind &lt;picture> and @srcset</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></description>
			<content:encoded><![CDATA[<p>Jason Grigsby explains it. Essentially: Browsers use a "pre-parser" to find resources in a document it will later need. This plays a huge role in making them fast. It can't wait around for layout information, which is exactly what responsive images need to make a smart call.</p>
<p><a href="http://blog.cloudfour.com/the-real-conflict-behind-picture-and-srcset/" title="Direct link to featured article">Direct Link to Article</a> &#8212; <a href="http://css-tricks.com/the-real-conflict-behind-picture-and-srcset/">Permalink</a></p><p><a href="http://css-tricks.com/the-real-conflict-behind-picture-and-srcset/">The real conflict behind &lt;picture> and @srcset</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></content:encoded>
			<wfw:commentRss>http://css-tricks.com/the-real-conflict-behind-picture-and-srcset/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Coda 2</title>
		<link>http://www.panic.com/coda/</link>
		<comments>http://css-tricks.com/coda-2/#comments</comments>
		<pubDate>Wed, 23 May 2012 02:58:50 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[Link]]></category>

		<guid isPermaLink="false">http://css-tricks.com/?p=17038</guid>
		<description><![CDATA[<p><p>This will be worth giving a real shot. </p>
<p><a href="http://www.panic.com/coda/" title="Direct link to featured article">Direct Link to Article</a> &#8212; <a href="http://css-tricks.com/coda-2/">Permalink</a>&#8230;</p></p><p><a href="http://css-tricks.com/coda-2/">Coda 2</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></description>
			<content:encoded><![CDATA[<p>This will be worth giving a real shot. </p>
<p><a href="http://www.panic.com/coda/" title="Direct link to featured article">Direct Link to Article</a> &#8212; <a href="http://css-tricks.com/coda-2/">Permalink</a></p><p><a href="http://css-tricks.com/coda-2/">Coda 2</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></content:encoded>
			<wfw:commentRss>http://css-tricks.com/coda-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ShopTalk Episode 19</title>
		<link>http://shoptalkshow.com/episodes/019-rapidfire-5/</link>
		<comments>http://css-tricks.com/shoptalk-episode-19/#comments</comments>
		<pubDate>Wed, 23 May 2012 02:56:07 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[Link]]></category>
		<category><![CDATA[ShopTalk]]></category>

		<guid isPermaLink="false">http://css-tricks.com/?p=17035</guid>
		<description><![CDATA[<p><p>Another RAPIDFIRE episode with pure question on answer action from Dave and I. Thanks to <a href="http://mijingo.com/">Mijingo</a> for sponsoring this weeks show.</p>
<p><a href="http://shoptalkshow.com/episodes/019-rapidfire-5/" title="Direct link to featured article">Direct Link to Article</a> &#8212; <a href="http://css-tricks.com/shoptalk-episode-19/">Permalink</a>&#8230;</p></p><p><a href="http://css-tricks.com/shoptalk-episode-19/">ShopTalk Episode 19</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></description>
			<content:encoded><![CDATA[<p>Another RAPIDFIRE episode with pure question on answer action from Dave and I. Thanks to <a href="http://mijingo.com/">Mijingo</a> for sponsoring this weeks show.</p>
<p><a href="http://shoptalkshow.com/episodes/019-rapidfire-5/" title="Direct link to featured article">Direct Link to Article</a> &#8212; <a href="http://css-tricks.com/shoptalk-episode-19/">Permalink</a></p><p><a href="http://css-tricks.com/shoptalk-episode-19/">ShopTalk Episode 19</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></content:encoded>
			<wfw:commentRss>http://css-tricks.com/shoptalk-episode-19/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SASS vs. LESS</title>
		<link>http://css-tricks.com/sass-vs-less/</link>
		<comments>http://css-tricks.com/sass-vs-less/#comments</comments>
		<pubDate>Thu, 17 May 2012 03:23:52 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[Article]]></category>

		<guid isPermaLink="false">http://css-tricks.com/?p=16922</guid>
		<description><![CDATA[<p><p><em>"Which CSS preprocessor language should I choose?"</em> is a hot topic lately. I've been asked in person several times and an online debate has been popping up every few days it seems. It's nice that the conversation has largely turned from whether or not preprocessing is a good idea to which one language is best. Let's do this thing.</p>
<p>Really short answer: SASS</p>
<p>Slightly longer answer: SASS is better on a whole bunch of different fronts, but if you are &#8230;</p></p><p><a href="http://css-tricks.com/sass-vs-less/">SASS vs. LESS</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></description>
			<content:encoded><![CDATA[<p><em>"Which CSS preprocessor language should I choose?"</em> is a hot topic lately. I've been asked in person several times and an online debate has been popping up every few days it seems. It's nice that the conversation has largely turned from whether or not preprocessing is a good idea to which one language is best. Let's do this thing.</p>
<p>Really short answer: SASS</p>
<p>Slightly longer answer: SASS is better on a whole bunch of different fronts, but if you are already happy in LESS, that's cool, at least you are doing yourself a favor by preprocessing.</p>
<p>Much longer answer: Read on.</p>
<p><span id="more-16922"></span></p>
<h3>The Much Longer Answer</h3>
<h4>The Learning Curve with Ruby and Command Line and Whatever</h4>
<p>The only learning curve is the syntax. You should use an app like <a href="http://incident57.com/codekit/">CodeKit</a> to watch and compile your authored files. You need to know jack squat about Ruby or the Command Line or whatever else. Maybe you should, but you don't have to, so it's not a factor here. </p>
<p>Winner: Nobody</p>
<h4>Helping with CSS3</h4>
<p>With either language, you can write your own mixins to help with vendor prefixes. No winner there. But you know how you don't go back and update the prefixes you use on all your projects? (You don't.) You also won't update your handcrafted mixins file. (Probably.) In SASS you can use <a href="http://compass-style.org/">Compass</a>, and Compass <strong>will</strong> keep itself updated, and thus the prefix situation is handled for you. Yes you'll have to keep your local preprocessor software updated and compile/push once in a while, but that's trivial and thinking-free.</p>
<p>So what this comes down to is: <strong>SASS has Compass and LESS does not.</strong> But it goes deeper than that. The attempts at creating a real robust project like Compass for LESS haven't succeeded because the LESS language isn't robust enough to do it properly. More on that next.</p>
<p>Winner: SASS</p>
<h4>Language Ability: Logic / Loops</h4>
<p>LESS has an ability to do "guarded mixins." These are mixins that only take affect <code>when</code> a certain condition is true. Perhaps you want to set a background color based on the current text color in a module. If the text color is "pretty light" you'll probably want a dark background. If it's "pretty dark" you'll want a light background. So you have a single mixin broke into two parts with these guards that ensure that only one of them takes effect.</p>
<pre rel="LESS"><code>.set-bg-color (@text-color) when (lightness(@text-color) &gt;= 50%) {
  background: black;
}
.set-bg-color (@text-color) when (lightness(@text-color) &lt; 50%) {
  background: #ccc;
}</code></pre>
<p>So then when you use it, you'll get the correct background:</p>
<pre rel="LESS"><code>.box-1 {
  color: #BADA55;
  .set-bg-color(#BADA55);
}</code></pre>
<p>That is overly simplified, but you likely get the idea. You can do some fancy stuff with it. LESS can also do self-referencing recursion where a mixin can call itself with an updated value creating a loop. </p>
<pre rel="LESS"><code>.loop (@index) when (@index &gt; 0) {
  .myclass {
    z-index: @index;
  }
  // Call itself
  .loopingClass(@index - 1);
}
// Stop loop
.loopingClass (0) {}

// Outputs stuff
.loopingClass (10);</code></pre>
<p>But thats where the logic/looping abilities of LESS end. SASS has actual logical and looping operators in the language. if/then/else statements, for loops, while loops, and each loops. No tricks, just proper programming. While guarded mixins are a pretty cool, natural concept, language robustness goes to SASS. This language robustness is what makes Compass possible. </p>
<p>For example, Compass has a mixin called <code>background</code>. It's so robust, that you can pass just about whatever you want to that thing that it will output what you need. Images, gradients, and any combination of them comma-separated, and you'll get what you need (vendor prefixes and all). </p>
<p>This succinct and intelligible code:</p>
<pre rel="SCSS"><code>.bam {
  @include background(
    image-url("foo.png"),
    linear-gradient(top left, #333, #0c0),
    radial-gradient(#c00, #fff 100px)
  );
}</code></pre>
<p>Turns into this monster (which is unfortunately what we need for it to work with as good of browser support as we can get):</p>
<pre rel="CSS"><code>.bam {
  background: url('/foo.png'), -webkit-gradient(linear, 0% 0%, 100% 100%, color-stop(0%, #333333), color-stop(100%, #00cc00)), -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 100, color-stop(0%, #cc0000), color-stop(100%, #ffffff));
  background: url('/foo.png'), -webkit-linear-gradient(top left, #333333, #00cc00), -webkit-radial-gradient(#cc0000, #ffffff 100px);
  background: url('/foo.png'), -moz-linear-gradient(top left, #333333, #00cc00), -moz-radial-gradient(#cc0000, #ffffff 100px);
  background: url('/foo.png'), -o-linear-gradient(top left, #333333, #00cc00), -o-radial-gradient(#cc0000, #ffffff 100px);
  background: url('/foo.png'), -ms-linear-gradient(top left, #333333, #00cc00), -ms-radial-gradient(#cc0000, #ffffff 100px);
  background: url('/foo.png'), linear-gradient(top left, #333333, #00cc00), radial-gradient(#cc0000, #ffffff 100px);
}</code></pre>
<p>Winner: SASS</p>
<h4>Website Niceitude</h4>
<p>LESS has a nicer, <a href="http://lesscss.org/">more usable website</a>. The <a href="http://sass-lang.com/docs/yardoc/file.SASS_REFERENCE.html">SASS documentation</a> isn't awful. It's complete and you can find what you need. But when competing for attention from front end people, LESS has the edge. I don't doubt this plays a large role in LESS currently winning the popularity race. <a href="http://twitter.com/TeamSassDesign">Things may be changing though.</a></p>
<p>Winner: LESS</p>
<h4>The @extend Concept</h4>
<p>Say you declare a class which has a bit of styling. Then you want another class which you want to do just about the same thing, only a few additional things. In LESS you'd likely:</p>
<pre rel="LESS"><code>.module-b {
   .module-a(); /* Copies everything from .module-a down here */
   border: 1px solid red;
}</code></pre>
<p>That's an "include" essentially. A mixin, in both languages. You could use an include to do that SASS as well, but you're better off using <code>@extend</code>. With <code>@extend</code>, the styles from <code>.module-a</code> aren't just duplicated down in .mobule-b (what could be considered bloat), the selector for .module-a is altered to <code>.module-a, .module-b</code> in the compiled CSS (which is more efficient).</p>
<pre rel="SCSS"><code>.module-a {
   /* A bunch of stuff */
}
.module-b {
   /* Some unique styling */
   @extend .module-a;
}</code></pre>
<p>Compiles into</p>
<pre rel="SCSS"><code>.module-a, .module-b {
  /* A bunch of stuff */
}
.module-b {
  /* Some unique styling */
}</code></pre>
<p>See that? It rewrites selectors, which is way more efficient.</p>
<p>Winner: SASS</p>
<h4>Variable Handling</h4>
<p>LESS uses @, SASS uses $. The dollar sign has no inherit meaning in CSS, while the @ sign does. It's for things like declaring @keyframes or blocks of @media queries. You could chalk this one up to personal preference and not a big deal, but I think the edge here is for SASS which doesn't confuse standing concepts.</p>
<p>SASS has some weirdness with scope in variables though. If you overwrite a "global" variable "locally", the global variable takes on the local value. This just feels kind of weird.</p>
<pre rel="CSS"><code>$color: black;
.scoped {
  $color: white;
  color: $color;
}
.unscoped {
  // LESS = black (global)
  // SASS = white (overwritten by local)
  color: $color;
}</code></pre>
<p>I've heard it can be useful but it's not intuitive, especially if you write JavaScript.</p>
<p>Winner: Tossup</p>
<h4>Working with Media Queries</h4>
<p>The way most of us started working with <code>@media</code> queries was adding blocks of them at the bottom of your main stylesheet. That works, but it leads to mental disconnect between the original styling and the responsive styles. Like:</p>
<pre rel="CSS"><code>.some-class {
   /* Default styling */
}

/* Hundreds of lines of CSS */

@media (max-width: 800px) {
  .some-class {
    /* Responsive styles */
  }
}</code></pre>
<p>With SASS or LESS, we can bring those styles together through nesting.</p>
<pre rel="SCSS"><code>.some-class {
  /* Default styling */
  @media (max-width: 800px) {
    /* Responsive styles */
  }
}</code></pre>
<p>You can get even sexier with SASS. There is a really cool "respond-to" technique (see code by <a href="https://gist.github.com/1215856">Chris Eppstein</a>, <a href="http://theint.ro/blogs/outro/4686992-responsive-design-with-sass">Ben Schwarz</a>, and <a href="http://jeffcroft.com/blog/2012/mar/02/implementing-responsive-design/">Jeff Croft</a>) for naming/using breakpoints.</p>
<pre rel="SASS"><code>=respond-to($name)

  @if $name == small-screen
    @media only screen and (min-width: 320px)
      @content

  @if $name == large-screen
    @media only screen and (min-width: 800px)
      @content</code></pre>
<p>The you can use them succinctly and semantically:</p>
<pre rel="SASS"><code>.column
    width: 25%
    +respond-to(small-screen)
      width: 100%</code></pre>
<p>Note: requires SASS 3.2, which is in alpha, which you can install with <code>gem install sass --pre</code>. I don't think there is any doubt this is a very nice way to work.</p>
<p>Winner: SASS</p>
<h4>Math</h4>
<p>For the most part, the math is similar, but there are some weirdnesses with how units are handled. For instance, LESS will assume the first unit you use is what you want out, ignoring further units.</p>
<pre rel="LESS"><code>div {
   width: 100px + 2em; // == 102px (weird)
}</code></pre>
<p>In SASS, you get a clear error: Incompatible units: 'em' and 'px'. I guess it's debatable if it's better to error or be wrong, but I'd personally rather have the error. Especially if you're dealing with variables rather than straight units and it's harder to track down.</p>
<p>SASS will also let you perform math on "unknown" units, making it a bit more futureproof should some new unit come along before they are able to update. LESS does not. There is some more weird differences like how SASS handles multiplying values that both have units, but it's esoteric enough to not be worth mentioning.</p>
<p>Winner: Narrowly SASS</p>
<h4>Active Development</h4>
<p>At the time of this writing...</p>
<p><a href="https://github.com/cloudhead/less.js/issues">Number of open issues</a> on LESS: 392<br />
<a href="https://github.com/nex3/sass/issues">Number of open issues</a> on SASS: 84</p>
<p><a href="https://github.com/cloudhead/less.js/pulls">Pending pull requests</a> on LESS: 86<br />
<a href="https://github.com/nex3/sass/pulls">Pending pull requests</a> on SASS: 3</p>
<p><a href="https://github.com/cloudhead/less.js/commits/master/">Number of commits</a> in the last month in LESS: 11<br />
<a href="https://github.com/nex3/sass/commits/stable/">Number of commits</a> in the last month in SASS: 35</p>
<p>None of that stuff is any definitive proof that one project is more active than the other, but the numbers do seem to always leans toward SASS. As I understand it, both of the leads work on the languages in whatever little free time they have, as they both have other major new projects they are working on. </p>
<p>Winner: Probably SASS</p>
<h3>More Reading</h3>
<ul>
<li>Chris Eppstein: <a href="https://gist.github.com/674726">SASS/LESS Comparison</a></li>
<li>Jeremy Hixon: <a href="http://coding.smashingmagazine.com/2011/09/09/an-introduction-to-less-and-comparison-to-sass/">An Introduction To LESS, And Comparison To Sass</a></li>
<li>Ken Collins: <a href="http://metaskills.net/2012/02/27/too-less-should-you-be-using-sass/">Too LESS? Should You Be Using Sass?</a></li>
<li>Johnathan Croom: <a href="http://net.tutsplus.com/tutorials/html-css-techniques/sass-vs-less-vs-stylus-a-preprocessor-shootout/">Sass vs. LESS vs. Stylus: Preprocessor Shootout</a></li>
</ul>
<p><a href="http://css-tricks.com/sass-vs-less/">SASS vs. LESS</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></content:encoded>
			<wfw:commentRss>http://css-tricks.com/sass-vs-less/feed/</wfw:commentRss>
		<slash:comments>200</slash:comments>
		</item>
		<item>
		<title>Responsive Images and Web Standards at the Turning Point</title>
		<link>http://www.alistapart.com/articles/responsive-images-and-web-standards-at-the-turning-point/</link>
		<comments>http://css-tricks.com/responsive-images-and-web-standards-at-the-turning-point/#comments</comments>
		<pubDate>Wed, 16 May 2012 04:04:17 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[Link]]></category>

		<guid isPermaLink="false">http://css-tricks.com/?p=17013</guid>
		<description><![CDATA[<p><p>Mat Marquis keeping us up to date on the responsive images hot drama. Good reminder at the end about not picking sides. </p>
<p><a href="http://www.alistapart.com/articles/responsive-images-and-web-standards-at-the-turning-point/" title="Direct link to featured article">Direct Link to Article</a> &#8212; <a href="http://css-tricks.com/responsive-images-and-web-standards-at-the-turning-point/">Permalink</a>&#8230;</p></p><p><a href="http://css-tricks.com/responsive-images-and-web-standards-at-the-turning-point/">Responsive Images and Web Standards at the Turning Point</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></description>
			<content:encoded><![CDATA[<p>Mat Marquis keeping us up to date on the responsive images hot drama. Good reminder at the end about not picking sides. </p>
<p><a href="http://www.alistapart.com/articles/responsive-images-and-web-standards-at-the-turning-point/" title="Direct link to featured article">Direct Link to Article</a> &#8212; <a href="http://css-tricks.com/responsive-images-and-web-standards-at-the-turning-point/">Permalink</a></p><p><a href="http://css-tricks.com/responsive-images-and-web-standards-at-the-turning-point/">Responsive Images and Web Standards at the Turning Point</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></content:encoded>
			<wfw:commentRss>http://css-tricks.com/responsive-images-and-web-standards-at-the-turning-point/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ShopTalk Episode 18</title>
		<link>http://shoptalkshow.com/episodes/018-with-gene-crawford/</link>
		<comments>http://css-tricks.com/shoptalk-episode-18/#comments</comments>
		<pubDate>Wed, 16 May 2012 00:11:46 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[Link]]></category>
		<category><![CDATA[ShopTalk]]></category>

		<guid isPermaLink="false">http://css-tricks.com/?p=17010</guid>
		<description><![CDATA[<p><p>With ol' Mean Gene Crawford! We talk about crazy clients, responsive images, health, and all kinds of other shoptalk. Thanks to <a href="http://mijingo.com/">Mijingo</a> for sponsoring this episode.</p>
<p><a href="http://shoptalkshow.com/episodes/018-with-gene-crawford/" title="Direct link to featured article">Direct Link to Article</a> &#8212; <a href="http://css-tricks.com/shoptalk-episode-18/">Permalink</a>&#8230;</p></p><p><a href="http://css-tricks.com/shoptalk-episode-18/">ShopTalk Episode 18</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></description>
			<content:encoded><![CDATA[<p>With ol' Mean Gene Crawford! We talk about crazy clients, responsive images, health, and all kinds of other shoptalk. Thanks to <a href="http://mijingo.com/">Mijingo</a> for sponsoring this episode.</p>
<p><a href="http://shoptalkshow.com/episodes/018-with-gene-crawford/" title="Direct link to featured article">Direct Link to Article</a> &#8212; <a href="http://css-tricks.com/shoptalk-episode-18/">Permalink</a></p><p><a href="http://css-tricks.com/shoptalk-episode-18/">ShopTalk Episode 18</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></content:encoded>
			<wfw:commentRss>http://css-tricks.com/shoptalk-episode-18/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Which responsive images solution should you use?</title>
		<link>http://css-tricks.com/which-responsive-images-solution-should-you-use/</link>
		<comments>http://css-tricks.com/which-responsive-images-solution-should-you-use/#comments</comments>
		<pubDate>Fri, 11 May 2012 14:39:32 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[Article]]></category>

		<guid isPermaLink="false">http://css-tricks.com/?p=16932</guid>
		<description><![CDATA[<p><p>There are a bunch of techniques going around for dealing with <strong>responsive images</strong> lately. That is, solutions to help us serve the right image for the occasion (e.g. size of screen and bandwidth available). They all do things a bit differently. To keep track, Christopher Schmitt and I have created <a href="https://docs.google.com/spreadsheet/ccc?key=0Al0lI17fOl9DdDgxTFVoRzFpV3VCdHk2NTBmdVI2OXc">this spreadsheet of techniques</a>.</p>
<p>The spreadsheet has the data, but let's digest it through thinking about it through the lens of practical questions.</p>
<p></p>
<p>To choose which technique is right &#8230;</p></p><p><a href="http://css-tricks.com/which-responsive-images-solution-should-you-use/">Which responsive images solution should you use?</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></description>
			<content:encoded><![CDATA[<p>There are a bunch of techniques going around for dealing with <strong>responsive images</strong> lately. That is, solutions to help us serve the right image for the occasion (e.g. size of screen and bandwidth available). They all do things a bit differently. To keep track, Christopher Schmitt and I have created <a href="https://docs.google.com/spreadsheet/ccc?key=0Al0lI17fOl9DdDgxTFVoRzFpV3VCdHk2NTBmdVI2OXc">this spreadsheet of techniques</a>.</p>
<p>The spreadsheet has the data, but let's digest it through thinking about it through the lens of practical questions.</p>
<p><span id="more-16932"></span></p>
<p>To choose which technique is right for you and your project these questions may help as a guide. Many of the questions may apply to your project, so you'll have to sort out which techniques fit what scenarios and find the overlap.</p>
<h3>Do I have legacy content?</h3>
<p>Which really means... <strong>do I have legacy content that is impractical to update?</strong> For instance, I have thousands of pages of content on CSS-Tricks and a writing staff of one. </p>
<figure><img src="http://cdn.css-tricks.com/wp-content/uploads/2012/05/legacycontent.png" alt="" title="legacycontent" width="148" height="147" class="alignnone size-full wp-image-16972" /></p>
<figcaption>Yeahhhh... I'm not going to go back and update every <code>&lt;img&gt;</code> on the site, so I need a technique that will allow me to leave those alone.</figcaption>
</figure>
<p>The only technique I know of that works with absolutely no markup changes is <a href="http://adaptive-images.com/">Adaptive Images</a>. It works by routing requests for images through a PHP file which intelligently serves (and creates if need be) images of the appropriate size for the screen width.</p>
<p>Another question to ask yourself is if you care about legacy content. Perhaps the vast majority of traffic to your site is for newer content in which you <strong>can</strong> make markup changes and thus take advantage of other techniques. If that's the case, read on to discover those other techniques.</p>
<p>If you have a small project, a brand new project, or a project with legacy content that you are able go back and update, you are also able to choose a technique which does require special markup, so also read on.</p>
<h4>Do I care about special markup?</h4>
<p>This is really a sub-question of the above. Many of the techniques require you to use special HTML. For example, <a href="https://github.com/teleject/hisrc">HiSRC</a> has you put higher resolution images as data-attributes:</p>
<pre rel="HTML"><code>&lt;img src="200x100.png" data-1x="400x200.png" data-2x="800x400.png"&gt;</code></pre>
<p>I'd say this is a clean, valid, semantic technique, but it also means that you need these attributes on every <code>&lt;img&gt;</code> on your site, which may not be possible on sites with loads of legacy content.</p>
<p>If you know that special markup (or specialized CSS) is not an option for you, really the only option is <a href="http://adaptive-images.com/">Adaptive Images</a>. Even <a href="http://www.sencha.com/products/io/">Sencha.IO</a> requires prefixing the src attribute which may not be possible with legacy content.</p>
<h3>Do I care about semantics?</h3>
<p>Some responsive images techniques involve markup which isn't strictly semantic. Ultimately, there is only one way an image can be semantic. That is if the <code>src</code> of it points to a real image and it has <code>alt</code> text describing that image. Brad Frost sums it up nicely:</p>
<blockquote class="twitter-tweet" data-in-reply-to="188023663029796866"><p>@<a href="https://twitter.com/stowball">stowball</a> Unfortunately its not that simple. A picture of a horse needs to be a picture of a horse or else its not a picture of a horse. :)</p>
<p>&mdash; Brad Frost (@brad_frost) <a href="https://twitter.com/brad_frost/status/188024708866912257" data-datetime="2012-04-05T22:05:58+00:00">April 5, 2012</a></p></blockquote>
<p><script src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
<p>In other words, if the technique requires at any point the <code>src</code> of the image to be missing or link to a transparent GIF (or the like), that's not semantic. </p>
<p>So why do some responsive images techniques do this? Because having an image with a <code>src</code> that points to that image of a horse means that that image will start downloading as soon as that image gets parsed by the browser. There is no practical way to prevent this. Even if you <em>super quickly</em> swap out that <code>src</code> with a more appropriate version, now you're downloading two images instead of one which is a performance hit instead of a performance gain. You may decide that's acceptable (e.g. "desktop" environments typically have more bandwidth). Usually if this technique is employed, the image in the <code>src</code> is the smallest possible image.</p>
<p>If semantics is important to you, you should look at <a href="http://adaptive-images.com/">Adaptive Images</a> (covered above) or <a href="https://github.com/teleject/hisrc">HiSRC</a>, a plugin by Christopher Schmitt which you can use with a semantic <code>src</code> attribute. </p>
<p>A few of the techniques use <code>&lt;noscript&gt;</code> tags in which to place a fallback <code>&lt;img&gt;</code> in the case of no JavaScript being available. I'll let you decide if that's semantic or not.</p>
<h3>Do I care about validity?</h3>
<p>Validity as in "Does it validate?" according to the <a href="http://validator.w3.org/">W3C Markup Validation Service</a>. Validation is a tool to help you find problems and write better markup. But just because something doesn't validate doesn't make it bad or wrong. If invalid code works wonderfully in all browsers, you nor anyone else should care.</p>
<p>If you do care about validity (perhaps a client irrationally requires it from you and is holding your paycheck randsom) then there are a few techniques that you can't use. The <a href="https://github.com/scottjehl/picturefill">picturefill</a> technique, for instance, uses the <code>&lt;picture&gt;</code> element to work its magic. This may ultimately be standarized, but it isn't yet, so it's technically invalid syntax. It's also required that <code>&lt;img&gt;</code> elements have a <code>src</code> attribute, so techniques that remove that to get around the double-image-request problem are invalid.</p>
<p>I'd recommend these techniques if validity is a requirement for you: <a href="http://adaptive-images.com/">Adaptive Images</a>, <a href="https://github.com/teleject/hisrc">HiSRC</a>, or <a href="https://github.com/joshje/Responsive-Enhance">Responsive Enhance</a>. All of which use simple, valid <code>&lt;img&gt;</code> syntax that include a <code>src</code>.</p>
<h3>Do I care about art direction?</h3>
<p>Some responsive images techniques serve different resolution versions of the exact same image. While that makes things easier (i.e. less work) it may not acceptable. Here's a visual example:</p>
<figure><img src="http://cdn.css-tricks.com/wp-content/uploads/2012/05/difimages.jpg" alt="" title="difimages" width="922" height="360" class="alignnone size-full wp-image-16963" /></p>
<figcaption>On the left, the "mobile" and default <code>src</code>. In the middle, a slightly larger image that could be used on (ahem) "tablets". On the right, the largest of the images.<a href="http://www.flickr.com/photos/whitehouse/7136874959/sizes/l/in/photostream/">(credit)</a></figcaption>
</figure>
<p>These images are hand-crafted by a designer, cropped to retain meaning and impact. If you took the image on the right and just scaled it down, the people in the image would be very small and the feel of the image my be lost. </p>
<p>If this idea of art direction is important to your project, you'll need a technique that will allow you to specify exactly which src to serve under which circumstances. This is picture perfect (GET IT?) for <a href="https://github.com/scottjehl/picturefill">picturefill</a> which allows you to be very specific about sources and what circumstances get what.</p>
<pre rel="HTML"><code>&lt;picture alt="description"&gt;
  &lt;source src="small.jpg"&gt;
  &lt;source src="medium.jpg" media="(min-width: 400px)"&gt;
  &lt;source src="large.jpg" media="(min-width: 800px)"&gt;
&lt;/picture&gt;</code></pre>
<p>JavaScript takes it from there. </p>
<h3>Do I care about JavaScript?</h3>
<p>Most of these responsive image techniques utilize JavaScript to work their magic. <a href="http://adaptive-images.com/">Some</a> only a tiny bit to set a cookie, but JavaScript none the less. Some of them have you put an <code>&lt;img&gt;</code> in a <code>&lt;noscript&gt;</code> tag so that there is a fallback image in the case that the user has JavaScript turned off. If you don't like that, and you need to make absolutely sure that your images work without JavaScript, <a href="http://www.sencha.com/products/io">Sencha.IO</a> is your best bet. This service works by identifying your device through it's <a href="http://en.wikipedia.org/wiki/User_agent">User Agent</a> string and serving an appropriately sized image. So you link to the largest (reasonable) version you have of it and Sencha will squeeze it down and server smaller versions if need be (it doesn't scale up, for obvious reasons). </p>
<h4>What about JavaScript *library* dependency?</h4>
<p><a href="https://github.com/teleject/hisrc">HiSRC</a> and <a href="https://github.com/stowball/jQuery-rwdImages">rwdImages</a> are both jQuery dependent. If your project is using a different library, these probably aren't for you. But hey, you could port it and open source that! If you aren't using a library, well, you probably should be but let's not get into that.</p>
<h3>Do I care about Server Side Components?</h3>
<p>Some of these techniques aren't solely JavaScript dependent. <a href="http://adaptive-images.com/">Adaptive Images</a> works it's magic primarily through .htaccess and PHP. Well, .htaccess presupposes an Apache server. And, while of course we all know and love PHP (ahem), many websites run on technologies like Ruby or Python. </p>
<p><a href="https://github.com/filamentgroup/Responsive-Images">Responsive Images</a> (the original Filament Group technique) also uses .htaccess. So if you're using something like <a href="http://wiki.nginx.org/Main">Nginx</a> as web server, this is either out or you'll have to port over the .htaccess component to Nginx's similar-but-different syntax.  </p>
<h3>Do I care about bandwidth testing?</h3>
<p>Testing the browser window width and making decisions on what image to serve based on that is pretty cool and fundamental to the concept of responsive images. But it's really only half of what the decision of what image should be served should be based on. The other half is available bandwidth. If the user has a very fast internet connection speed, serving large images is OK. If the user has a very slow internet connection speed, they should get smaller images (regardless of screens size). Unfortunately native <a href="http://css-tricks.com/bandwidth-media-queries/">bandwidth media queries</a> don't exist. </p>
<p>Two of the current techniques do bandwidth testing as part of their decision making: <a href="https://github.com/adamdbradley/foresight.js">Foresight.js</a> and <a href="https://github.com/teleject/hisrc">HiSRC</a> (both are based on the technique in Foresight.js). It works by downloading a test file and measuring how long it took (configurable). The test itself is a slight performance hit, but theoretically the savings gained by serving images based on knowing the current bandwidth is a net (GET IT?) gain. </p>
<h3>Do I care about relying on third parties?</h3>
<p><a href="http://www.sencha.com/products/io/">Sencha.IO</a> is a completely third-party way of handling responsive images. As far as I know, it works great and hasn't been inflicted with any major downtime, but of course you always run that risk.</p>
<p>You might be thinking: <em>Wow, the Sencha.IO technique is really cool but I worry about the third-party dependency. I wish I could run that on my own server.</em> If you want to go down that road, there is the public <a href="http://wurfl.sourceforge.net/">WURFL database</a> and this <a href="https://github.com/carsonmcdonald/ServerSideResponsiveImageExample">Server Side Responsive Images technique</a> which puts that to work locally.</p>
<p>There are also third-party services like <a href="http://deviceatlas.com/products/cloud">Device Atlas Cloud</a> which does device detection for you. It's also a third-party dependency for your app. No doubt their goal and focus is staying up and fast at all times, but you have to be very careful about who and what you rely on for your business.</p>
<h3>Is there a specific CMS with specific CMS powers involved?</h3>
<p>Say your project is in WordPress. WordPress has a media uploader built in. When you upload an image with it, it can create multiple versions (scaling down) of that image for you. That's pretty cool and powerful and you could/should take advantage of that. Keir Whitaker talks about using that ability in his article <a href="http://viewportindustries.com/blog/automatic-responsive-images-in-wordpress/">Automatic Responsive Images in WordPress</a>.</p>
<p>This isn't just a WordPress thing though. I'm sure the concepts at work here could be done (or made to be done) in any Content Management System.</p>
<h3>Can I wait for the future?</h3>
<p>The release of the "new iPad" (the third one, for longevity) is what sparked a lot of these techniques and conversations. Its high pixel density is great for vectors and big photos, but actually not great for things like small icons that need to be scaled up to be the correct size and can be blurry. But serving higher resolution icons means larger file sizes and slower websites. Hence, the need to only serve them in situations/environments that need them. </p>
<p>The world of web standards is aware of this problem. There is a <a href="http://www.w3.org/community/respimg/">whole group</a> dedicated to talking about it. In time, they may solve it and then we can start using whatever way they come up with (assuming its awesome and better than what we have now).</p>
<p>It may be flipping out the src of images <a href="http://nicolasgallagher.com/responsive-images-using-css3/">through CSS content</a> like Nicolas Gallagher suggested. It might be the <code>&lt;picture&gt;</code> element. It might be a <a href="http://robertnyman.com/2011/05/30/discussing-alternatives-for-various-sizes-of-the-same-image-introducing-src-property-in-css-as-an-option/">srclist attribute in HTML or src property in CSS</a>. It might be a <a href="http://blog.yoav.ws/2011/05/My-take-on-adaptive-images">prefix</a>.</p>
<p>&nbsp;</p>
<h3>More resources</h3>
<ul>
<li>Jason Grigsby has an epic three-part series on responsive images <a href="http://blog.cloudfour.com/responsive-imgs/">starting here</a>.</li>
<li>Christopher Schmitt's <a href="http://www.slideshare.net/teleject/convergese-adaptiveimagesconverge-se">slides on a whole talk</a> about responsive images.</li>
<li>Mat Marquis on <a href="http://www.alistapart.com/articles/responsive-images-how-they-almost-worked-and-what-we-need/">Responsive Images: How they Almost Worked and What We Need</a></li>
</ul>
<p><a href="http://css-tricks.com/which-responsive-images-solution-should-you-use/">Which responsive images solution should you use?</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></content:encoded>
			<wfw:commentRss>http://css-tricks.com/which-responsive-images-solution-should-you-use/feed/</wfw:commentRss>
		<slash:comments>37</slash:comments>
		</item>
		<item>
		<title>Opt-in Typography</title>
		<link>http://css-tricks.com/opt-in-typography/</link>
		<comments>http://css-tricks.com/opt-in-typography/#comments</comments>
		<pubDate>Mon, 07 May 2012 15:19:59 +0000</pubDate>
		<dc:creator>Chris Coyier</dc:creator>
				<category><![CDATA[Article]]></category>

		<guid isPermaLink="false">http://css-tricks.com/?p=16941</guid>
		<description><![CDATA[<p><p>I recently heard <a href="http://chriseppstein.github.com/">Chris Eppstein</a> give a talk (<a href="http://speakerdeck.com/u/chriseppstein/p/help-my-stylesheets-are-a-mess">slides</a>) about creating better stylesheets and using <a href="http://sass-lang.com/">SASS</a> to do it. There were a couple of surprising bits in there, one of which was about "opt-in typography." The idea was that instead of setting global styles for typographic elements like <code>p</code>, <code>ul</code>, <code>ol</code>, <code>h1</code>, <code>h2</code>, etc that you would instead apply those styles as a class, perhaps <code>.text</code>. </p>
<p>The idea is that there is &#8230;</p></p><p><a href="http://css-tricks.com/opt-in-typography/">Opt-in Typography</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></description>
			<content:encoded><![CDATA[<p>I recently heard <a href="http://chriseppstein.github.com/">Chris Eppstein</a> give a talk (<a href="http://speakerdeck.com/u/chriseppstein/p/help-my-stylesheets-are-a-mess">slides</a>) about creating better stylesheets and using <a href="http://sass-lang.com/">SASS</a> to do it. There were a couple of surprising bits in there, one of which was about "opt-in typography." The idea was that instead of setting global styles for typographic elements like <code>p</code>, <code>ul</code>, <code>ol</code>, <code>h1</code>, <code>h2</code>, etc that you would instead apply those styles as a class, perhaps <code>.text</code>. <span id="more-16941"></span></p>
<p>The idea is that there is a lot of places on a website where you want a clean slate to work from and not be worried about what global styles are doing. The classic example is lists, where when using them for things like navigation you likely don't want the same margin/padding/list-style as you would within an article.</p>
<p>Further, you might have different sets of typographic styles you may want to apply at will. So, instead of global styles like this:</p>
<pre rel="CSS"><code>p  {    }
ul {    }
ol {    }
h1 {    }
h2 {    }
/* etc */</code></pre>
<p>You would scope them to a class instead (using SCSS here):</p>
<pre rel="SCSS"><code>.text-article {
  p  {    }
  ul {    }
  ol {    }
  h1 {    }
  h2 {    }
  /* etc */
}

.text-module {
  p  {    }
  ul {    }
  ol {    }
  h1 {    }
  h2 {    }
  /* etc */
}</code></pre>
<p>In an area of the site that's a blog post, you can snag your article typography, and in a sidebar module, you can grab the typography for that:</p>
<pre rel="HTML"><code>&lt;section class="main-content"&gt;
  &lt;article class="text-article"&gt;
    ...
  &lt;/article&gt;
&lt;/section&gt;
&lt;aside&gt;
  &lt;div class="module text-module"&gt;
     Texty module
  &lt;/div&gt;
  &lt;div class="module"&gt;
     Module in which typography isn't needed
  &lt;/div&gt;
&lt;/aside&gt;</code></pre>
<p>Anthony Short <a href="http://anthonyshort.me/2012/05/global-typographic-styles-suck">feels the same way</a>. </p>
<p>Of course, the effectiveness of this depends on the website. What kind of site it is and what stage in it's evolution it's in. I suspect it would work better on websites that have a more "modular" architecture and that don't have a huge set of legacy content. I'd be interested in trying it on a fresh project.</p>
<p><a href="http://css-tricks.com/opt-in-typography/">Opt-in Typography</a> is a post from <a href="http://css-tricks.com">CSS-Tricks</a></p>]]></content:encoded>
			<wfw:commentRss>http://css-tricks.com/opt-in-typography/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced
Database Caching using apc
Object Caching 1563/1677 objects using apc
Content Delivery Network via cdn.css-tricks.com

Served from: css-tricks.com @ 2012-05-24 19:55:17 -->

