<?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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Kilian Valkhof</title>
	
	<link>http://kilianvalkhof.com</link>
	<description />
	<lastBuildDate>Thu, 04 Mar 2010 18:18:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Kilianvalkhofcom" /><feedburner:info uri="kilianvalkhofcom" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>CSS3 loading spinners without images</title>
		<link>http://feedproxy.google.com/~r/Kilianvalkhofcom/~3/lWrwUq74fsY/</link>
		<comments>http://kilianvalkhof.com/2010/css-xhtml/css3-loading-spinners-without-images/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 04:00:53 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
				<category><![CDATA[CSS & (X)HTML]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=575</guid>
		<description><![CDATA[<blockquote><p>After playing around with chaining different transforms, I found out something interesting&#8230;</p></blockquote><p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2010/css-xhtml/css3-loading-spinners-without-images/">CSS3 loading spinners without images</a></p>
]]></description>
			<content:encoded><![CDATA[<p>While playing around with css-transform to make various shapes, I saw a way to create animated image-less loading spinners such as used in a lot of webapps and of course on the iPhone.<span id="more-575"></span></p>
<h3>CSS transforms</h3>
<p>CSS transform (in Firefox 3.5+ and Webkit-based browsers) has a whole bunch of interesting functions, such as rotation, translation, scaling and skewing. To learn more about the different functions, check out the Mozilla developer center overview of <a href="https://developer.mozilla.org/en/CSS/-moz-transform">CSS transform</a>. After playing around with chaining different transforms and seeing the effect, I found out something interesting:</p>
<div style="width:100px;height:100px;border:1px solid #eee;position:relative;margin-bottom:1.5em">
<div style="position:absolute;height:50px;width:20px;top:25px;left:40px;background:#ddd;"></div>
<div style="position:absolute;height:50px;width:20px;top:25px;left:40px;background:#000;-moz-transform:rotate(45deg) translate(0, -35px);-webkit-transform:rotate(45deg) translate(0, -35px)"></div>
</div>
<pre><code>transform:rotate(45deg) translate(0, -35px);</code></pre>
<p>If you rotate first, and then translate (move), it will move <em>along the rotated axis</em>. The above code translates a block to the top-right corner (45 degrees). (the gray div is not transformed while the black one is.)</p>
<p>Using this, I could rotate and translate a bunch of divs to create loading spinners (though this one doesn&#8217;t spin yet!):</p>
<div id="div1">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
<div class="bar4"></div>
<div class="bar5"></div>
<div class="bar6"></div>
<div class="bar7"></div>
<div class="bar8"></div>
</div>
<p>In this example, each div is rotated an additional 45 degrees. The first one is not rotated, the second one is rotated 45 degrees, the one after that 90 degrees, and so forth. Additionally, each div has increased opacity to make it look like most loading spinners.</p>
<h3>Animation</h3>
<p>Webkit supports CSS animations, but these are continuous while most loading spinners are not. On the left side is a spinner animated with CSS animation (only works in Safari and Chrome), on the right there&#8217;s one animated with a small bit of JavaScript to look like regular loading spinners:</p>
<div id="div2">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
<div class="bar4"></div>
<div class="bar5"></div>
<div class="bar6"></div>
<div class="bar7"></div>
<div class="bar8"></div>
</div>
<div id="div3">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
<div class="bar4"></div>
<div class="bar5"></div>
<div class="bar6"></div>
<div class="bar7"></div>
<div class="bar8"></div>
</div>
<p style="clear:both">The code for the CSS animation is fairly straightforward:</p>
<pre><code>#div2 {
  -webkit-animation-name: rotateThis;
  -webkit-animation-duration:2s;
  -webkit-animation-iteration-count:infinite;
  -webkit-animation-timing-function:linear;
}
@-webkit-keyframes rotateThis {
  from {-webkit-transform:scale(0.5) rotate(0deg);}
  to {-webkit-transform:scale(0.5) rotate(360deg);}
} </code></pre>
<p>While the (quick and dirty) code for the JavaScript animation is pretty easy as well:</p>
<pre><code>  var count = 0;
  function rotate() {
    var elem2 = document.getElementById('div3');
    elem2.style.MozTransform = 'scale(0.5) rotate('+count+'deg)';
    elem2.style.WebkitTransform = 'scale(0.5) rotate('+count+'deg)';
    if (count==360) { count = 0 }
    count+=45;
    window.setTimeout(rotate, 100);
  }
  window.setTimeout(rotate, 100);</code></pre>
<p>Someone else might be able to duplicate the loading spinner-style rotation with CSS animations (please let me know!), but the JavaScript solution looks better and works in Firefox too.</p>
<h3>Going crazy with it (More examples!)</h2>
<p>Once I had the basic &#8216;functionality&#8217; working, I just decided to go crazy with it and create a whole bunch of different style loading spinners. You can find them on this page: <strong><a href="/uploads/spinners/">CSS3 loading spinner examples</a></strong>. </p>
<p>Check out the source for the way to style the different spinners and let me know when you make interesting variations!</p>
<style>
/* position the bars and balls correctly (rotate them and translate them outward)*/
.bar1 {
  -moz-transform:rotate(0deg) translate(0, -40px);
  -webkit-transform:rotate(0deg) translate(0, -40px);opacity:0.12;
}
.bar2 {
  -moz-transform:rotate(45deg) translate(0, -40px);
  -webkit-transform:rotate(45deg) translate(0, -40px);opacity:0.25;
}
.bar3 {
  -moz-transform:rotate(90deg) translate(0, -40px);
  -webkit-transform:rotate(90deg) translate(0, -40px);opacity:0.37;
}
.bar4 {
  -moz-transform:rotate(135deg) translate(0, -40px);
  -webkit-transform:rotate(135deg) translate(0, -40px);opacity:0.50;
}
.bar5 {
  -moz-transform:rotate(180deg) translate(0, -40px);
  -webkit-transform:rotate(180deg) translate(0, -40px);opacity:0.62;
}
.bar6 {
  -moz-transform:rotate(225deg) translate(0, -40px);
  -webkit-transform:rotate(225deg) translate(0, -40px);opacity:0.75;
}
.bar7 {
  -moz-transform:rotate(270deg) translate(0, -40px);
  -webkit-transform:rotate(270deg) translate(0, -40px);opacity:0.87;
}
.bar8 {
  -moz-transform:rotate(315deg) translate(0, -40px);
  -webkit-transform:rotate(315deg) translate(0, -40px);opacity:1;
}
#div1, #div2, #div3 {
  position:relative;
  width:100px;
  height:100px;
  margin-bottom:1.5em;
  margin-right:1.5em;
  -moz-border-radius:100px;
  float:left;
  -moz-transform:scale(0.5);
  -webkit-transform:scale(0.5);
}
#div1 {float:none}
#div1 div,
#div2 div,
#div3 div {
  width:10px;
  height:30px;
  background:#000;
  position:absolute;
  top:35px;
  left:45px;
}
#div2 {
  -webkit-animation-name: rotateThis;
  -webkit-animation-duration:2s;
  -webkit-animation-iteration-count:infinite;
  -webkit-animation-timing-function:linear;
}
@-webkit-keyframes rotateThis {
  from {-webkit-transform:scale(0.5) rotate(0deg);}
  to {-webkit-transform:scale(0.5) rotate(360deg);}
} 
</style>
<p><script>
  var count = 0;
  function rotate() {
    var elem2 = document.getElementById('div3');
    elem2.style.MozTransform = 'scale(0.5) rotate('+count+'deg)';
    elem2.style.WebkitTransform = 'scale(0.5) rotate('+count+'deg)';
    if (count==360) { count = 0 }
    count+=45;
    window.setTimeout(rotate, 100);
  }
  window.setTimeout(rotate, 100);
</script></p>
<p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2010/css-xhtml/css3-loading-spinners-without-images/">CSS3 loading spinners without images</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=lWrwUq74fsY:Ny82DFRkGOQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=lWrwUq74fsY:Ny82DFRkGOQ:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=lWrwUq74fsY:Ny82DFRkGOQ:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=lWrwUq74fsY:Ny82DFRkGOQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=lWrwUq74fsY:Ny82DFRkGOQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=lWrwUq74fsY:Ny82DFRkGOQ:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=lWrwUq74fsY:Ny82DFRkGOQ:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=lWrwUq74fsY:Ny82DFRkGOQ:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=lWrwUq74fsY:Ny82DFRkGOQ:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=lWrwUq74fsY:Ny82DFRkGOQ:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=lWrwUq74fsY:Ny82DFRkGOQ:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=lWrwUq74fsY:Ny82DFRkGOQ:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Kilianvalkhofcom/~4/lWrwUq74fsY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2010/css-xhtml/css3-loading-spinners-without-images/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		<feedburner:origLink>http://kilianvalkhof.com/2010/css-xhtml/css3-loading-spinners-without-images/</feedburner:origLink></item>
		<item>
		<title>SenCSs 0.7 is out</title>
		<link>http://feedproxy.google.com/~r/Kilianvalkhofcom/~3/FFZgAgLqckk/</link>
		<comments>http://kilianvalkhof.com/2010/sencss/sencss-0-7-is-out/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 04:00:31 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
				<category><![CDATA[SenCSs]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=566</guid>
		<description><![CDATA[<blockquote><p>For most sites, cherry-picking from sen.extra.css works much better. </p></blockquote><p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2010/sencss/sencss-0-7-is-out/">SenCSs 0.7 is out</a></p>
]]></description>
			<content:encoded><![CDATA[<p>After nearly a year of no official new version (but active development and use regardless) I&#8217;ve now officially released the new version of SenCSs: version 0.7. This latest version splits senCSs into multiple files and has a host of smaller improvements.<span id="more-566"></span></p>
<p><strong>So, go get it at <a href="http://sencss.kilianvalkhof.com">sencss.kilianvalkhof.com</a>!</strong></p>
<h2>Extra, Extra!</h2>
<p>The biggest change is that I&#8217;ve split all the class specific styles into their own file, <code>sen.extra.css</code> because I noticed that for most sites, cherry-picking from sen.extra.css works much better. This brings the size of sen.css down to a small 5kb. None of the styles have disappeared, so horizontal forms, message styles and typographic classes are all still there and you can include them all, or just the ones you need.</p>
<h3>Move to Github</h3>
<p>Pretty much all my open source work in the past year has been published on Github except for SenCSs, which up till now was located at <a href="http://code.google.com/p/sencss">Google Code</a>. Github kicks Google Code&#8217;s ass in almost every way and active development is much easier this way. With <a href="http://github.com/kilian/sencss">SenCSs on Github</a>, I hope to recieve patches and improvements from other people as well. </p>
<h3>Other changes</h3>
<p>The CSS for forms has received an update, with cleaner selectors, fixes for the display of buttons and the vertical rhythm. This release also has fixes for <a href="http://meyerweb.com/eric/thoughts/2010/02/12/fixed-monospace-sizing/">monospace text</a> in webkit and various bugs in IE8.</p>
<h3>Full change log:</h3>
<ul>
<li>move all helper classes to an external file</li>
<li>Fix vertical rhythm for certain form elements</li>
<li>Remove the text-align center from message styles</li>
<li>add explicit font-weight declarations to the heading elements</li>
<li>clean up documentation and repository</li>
<li>move fully to GitHub</li>
<li>hide focus effect on buttons in firefox</li>
<li>clean up form css</li>
<li>add a number of IE8 fixes</li>
</ul>
<p>I hope you enjoy this release, and I look forward to the forks and patches that can be made thanks to hosting it on GitHub!</p>
<p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2010/sencss/sencss-0-7-is-out/">SenCSs 0.7 is out</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=FFZgAgLqckk:O5xLUbB_NTc:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=FFZgAgLqckk:O5xLUbB_NTc:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=FFZgAgLqckk:O5xLUbB_NTc:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=FFZgAgLqckk:O5xLUbB_NTc:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=FFZgAgLqckk:O5xLUbB_NTc:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=FFZgAgLqckk:O5xLUbB_NTc:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=FFZgAgLqckk:O5xLUbB_NTc:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=FFZgAgLqckk:O5xLUbB_NTc:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=FFZgAgLqckk:O5xLUbB_NTc:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=FFZgAgLqckk:O5xLUbB_NTc:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=FFZgAgLqckk:O5xLUbB_NTc:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=FFZgAgLqckk:O5xLUbB_NTc:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Kilianvalkhofcom/~4/FFZgAgLqckk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2010/sencss/sencss-0-7-is-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kilianvalkhof.com/2010/sencss/sencss-0-7-is-out/</feedburner:origLink></item>
		<item>
		<title>Grafico: Javascript charting library</title>
		<link>http://feedproxy.google.com/~r/Kilianvalkhofcom/~3/HEIKSyuIKgU/</link>
		<comments>http://kilianvalkhof.com/2010/design/grafico-javascript-charting-library/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 04:00:30 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=541</guid>
		<description><![CDATA[<blockquote><p>There are a lot of bad charts out there, and Grafico will do it's best to prevent you from adding charts onto that pile. ;)</p></blockquote><p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2010/design/grafico-javascript-charting-library/">Grafico: Javascript charting library</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Grafico is a javascript charting library built with Raphaël and Prototype.js. The library provides a wide array of graphs and stays with the guidelines laid out by Stephen Few and Edward Tufte. <strong>Grafico provides pretty charts that effectively communicate their information.</strong><span id="more-541"></span></p>
<h2>Graphs</h2>
<p>This means you get awesome graphs such as <em>stacked area charts</em> and <em>sparklines</em>, but no pie charts or bar charts with every bar a different color. There are a lot of bad charts out there, and Grafico will do it&#8217;s best to prevent you from adding charts onto that pile. ;)</p>
<p><img src="http://grafico.kilianvalkhof.com/grafico-example.png" alt="" /><br />
<strong><a href="http://grafico.kilianvalkhof.com">Website</a></strong>, <strong><a href="http://grafico.kilianvalkhof.com/documentation/">Documentation</a></strong> (might be slow on some browsers due to all the examples)</p>
<div style="float:right;margin-left:2em;">
Available graphs:</p>
<ul>
<li><a href="http://grafico.kilianvalkhof.com/documentation/index.html#line">Line graphs</a></li>
<li><a href="http://grafico.kilianvalkhof.com/documentation/index.html#area">Area graphs</a></li>
<li><a href="http://grafico.kilianvalkhof.com/documentation/index.html#stack">Stacked area graphs</a></li>
<li><a href="http://grafico.kilianvalkhof.com/documentation/index.html#stream">Stream graphs</a></li>
<li><a href="http://grafico.kilianvalkhof.com/documentation/index.html#bar">Bar graphs</a></li>
<li><a href="http://grafico.kilianvalkhof.com/documentation/index.html#horizontalbar">Horizontal bar graphs</a></li>
<li><a href="http://grafico.kilianvalkhof.com/documentation/index.html#sparkline">Sparklines</a></li>
<li><a href="http://grafico.kilianvalkhof.com/documentation/index.html#sparkbar">Sparkbars</a></li>
<li><a href="http://grafico.kilianvalkhof.com/documentation/index.html#sparkarea">Sparkareas</a></li>
</ul>
</div>
<p>Grafico requires <a href="http://raphaeljs.com">Raphaël</a> 1.0+ and <a href="http://prototypejs.org">Prototype.js</a> 1.6+</p>
<p>Each graph type has numerous API options to customize it&#8217;s look and behavior. Many examples of this can be found in the <a href="http://grafico.kilianvalkhof.com/documentation/">documentation</a>. Some highlights: pop-up hovers, meanlines and watermarks. Minified, Grafico is about 30kb and available under the MIT license.</p>
<p>Grafico is also available on <a href="http://github.com/kilian/grafico">Github</a> and includes a minification script made by <a href="http://wakoopa.com/menno">Menno</a> using the Google Closure Compiler.</p>
<h3 style="clear:both">History</h3>
<p>In april 2009 I started working on new visualizations for <a href="http://wakoopa.com">Wakoopa</a>. I had set it my target to provide unique and interesting graphs. One thing that particularly inspired me was the <a href="http://www.neoformix.com/2008/StreamGraph.html">stream graph</a>, but the <a href="http://www.neoformix.com/2008/StreamGraph.html">math behind</a> it scared the crap out of me. I decided to focus on stacked area graphs instead.</p>
<p>After doing extensive research on the available JavaScript charting libraries, and being slightly disappointed by most, <a href="http://alexyoung.org/2009/01/21/ico-svg-graphs-with-prototype-and-raphael/">Ico by Alex Young</a> was the most promising. In the (almost ) year I worked on it, the graphs, code and API changed considerably. To avoid confusion I decided to rename my version to Grafico. </p>
<h3>Todo</h3>
<p>As always, there are points of improvement. The major one is speed. Grafico is very speedy on modern browsers, but of course IE lags behind. When building graphs, drawing pop-up hovers for all data points takes too much time and I have yet to find a way to improve this. The project lives on <a href="http://github.com/kilian/grafico">Github</a>, so if you have improvements, fork away and I&#8217;ll gladly pull them!</p>
<h2>Update! (16 Feb 2010)</h2>
<p><a href="http://janpaulposma.nl">Jan Paul Posma</a> wrote the code to implement the aforementioned stream graphs into Grafico. Which is <em>awesome</em>. I have updated the links in this article accordingly.</p>
<p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2010/design/grafico-javascript-charting-library/">Grafico: Javascript charting library</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=HEIKSyuIKgU:oOEI-soFYgo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=HEIKSyuIKgU:oOEI-soFYgo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=HEIKSyuIKgU:oOEI-soFYgo:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=HEIKSyuIKgU:oOEI-soFYgo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=HEIKSyuIKgU:oOEI-soFYgo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=HEIKSyuIKgU:oOEI-soFYgo:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=HEIKSyuIKgU:oOEI-soFYgo:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=HEIKSyuIKgU:oOEI-soFYgo:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=HEIKSyuIKgU:oOEI-soFYgo:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=HEIKSyuIKgU:oOEI-soFYgo:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=HEIKSyuIKgU:oOEI-soFYgo:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=HEIKSyuIKgU:oOEI-soFYgo:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Kilianvalkhofcom/~4/HEIKSyuIKgU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2010/design/grafico-javascript-charting-library/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		<feedburner:origLink>http://kilianvalkhof.com/2010/design/grafico-javascript-charting-library/</feedburner:origLink></item>
		<item>
		<title>The problem with SVG and Canvas</title>
		<link>http://feedproxy.google.com/~r/Kilianvalkhofcom/~3/bmVNUAS3VAs/</link>
		<comments>http://kilianvalkhof.com/2010/design/the-problem-with-svg-and-canvas/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 04:00:52 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
				<category><![CDATA[Design]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=486</guid>
		<description><![CDATA[<blockquote><p>SVG and Canvas should not care about pixels, because they work in vectors. The lines are blurry <em>by design</em>.</p></blockquote><p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2010/design/the-problem-with-svg-and-canvas/">The problem with SVG and Canvas</a></p>
]]></description>
			<content:encoded><![CDATA[<p>SVG and canvas are awesome technologies, and are changing the way we use graphics on the web. I love working with both, and support for both keeps improving (IE9 might even <a href="http://blogs.msdn.com/ie/archive/2010/01/05/microsoft-joins-w3c-svg-working-group.aspx">support SVG</a>!) However, they have one problem that is really getting to me, and it&#8217;s not even their fault.<span id="more-486"></span></p>
<h3>Vectors</h3>
<p>You see, SVG and Canvas are based on vectors. This means that they don&#8217;t really care about the pixels they get drawn on, their graphic implementation takes care of that. And thats a problem. This is the code to draw a 1px line in canvas:</p>
<pre><code>var canvas1, context1;
    canvas1 = document.getElementById("canvas1");
    canvas1.height = 20;
    canvas1.width = 560;
    context1 = canvas1.getContext("2d");
    context1.strokeStyle = '#000000';

    // draw
    context1.moveTo(1,10);
    context1.lineTo(200,10);
    context1.stroke();</code></pre>
<div><canvas id="canvas1"></canvas></div>
<div><script type="text/javascript">
  var canvas1, context1;
    canvas1 = document.getElementById("canvas1");
    canvas1.height = 20;
    canvas1.width = 560;
    context1 = canvas1.getContext("2d");
    context1.strokeStyle = '#000000';
    // draw
    context1.moveTo(1,10);
    context1.lineTo(560,10);
    context1.stroke();
</script></div>
<p>As you can see, that line is <em>blurry</em>. I don&#8217;t want my lines to be blurry. Luckily there is an easy fix:</p>
<pre></code>context1.moveTo(1,10<strong>.5</strong>);
context1.lineTo(200,10<strong>.5</strong>);
context1.stroke();</code></pre>
<div><canvas id="canvas2"></canvas></div>
<div><script type="text/javascript">
  var canvas2, context2;
    canvas2 = document.getElementById("canvas2");
    canvas2.height = 20;
    canvas2.width = 560;
    context2 = canvas2.getContext("2d");
    context2.strokeStyle = '#000000';
    // draw
    context2.moveTo(1,10.5);
    context2.lineTo(560,10.5);
    context2.stroke();
</script></div>
<p>Just <a href="http://www.diveintohtml5.org/canvas.html#pixel-madness">offset with half a pixel</a>, and it&#8217;ll render nice and sharp. This works, because in SVG and in Canvas, pixels aren&#8217;t seen as an indivisible unit. You can draw on a <em>part</em> of a pixel. </p>
<p>When you code a line to start at a certain pixel, you are actually starting the line in the <strong>top-left corner</strong> of that pixel. When that line is 1px wide, half a the line gets drawn on one pixel, and the other half on the one next to it, resulting in a blurry line.</p>
<p>As I said, this is&#8217;t really SVG or Canvas&#8217; fault. SVG and Canvas should not care about pixels, because they work in vectors. The lines are blurry <em>by design</em>. However, the last thing a canvas or SVG developer should want is code littered with <code>+0.5</code> and currently, this is exactly what happens.</p>
<h3>What I want</h3>
<p>I don&#8217;t want to have to write <code>+0.5</code> all throughout my canvas or SVG generating code. I want the canvas or SVG implementation to be smart enough to know when that line is going to be unintentionally blurry, and make sure it&#8217;s not. Now, an implementation might not be able to determine this, I don&#8217;t know. </p>
<p>At the very least, give developers a global option to switch between the two &#8220;modes&#8221; (one being theoretically correct, the other giving sharp lines). <strong>Call it <code>alignToRaster</code> (a boolean, as a property of the canvas, defaults to false) and if set to true, silently add the 0.5px for me.</strong></p>
<p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2010/design/the-problem-with-svg-and-canvas/">The problem with SVG and Canvas</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bmVNUAS3VAs:mReeEiG0FoU:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bmVNUAS3VAs:mReeEiG0FoU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=bmVNUAS3VAs:mReeEiG0FoU:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bmVNUAS3VAs:mReeEiG0FoU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=bmVNUAS3VAs:mReeEiG0FoU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bmVNUAS3VAs:mReeEiG0FoU:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bmVNUAS3VAs:mReeEiG0FoU:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=bmVNUAS3VAs:mReeEiG0FoU:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bmVNUAS3VAs:mReeEiG0FoU:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bmVNUAS3VAs:mReeEiG0FoU:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bmVNUAS3VAs:mReeEiG0FoU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=bmVNUAS3VAs:mReeEiG0FoU:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Kilianvalkhofcom/~4/bmVNUAS3VAs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2010/design/the-problem-with-svg-and-canvas/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://kilianvalkhof.com/2010/design/the-problem-with-svg-and-canvas/</feedburner:origLink></item>
		<item>
		<title>The state of selectable text-replacement</title>
		<link>http://feedproxy.google.com/~r/Kilianvalkhofcom/~3/bNa0wLqCp7g/</link>
		<comments>http://kilianvalkhof.com/2009/javascript/the-state-of-selectable-text-replacement/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 04:00:53 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=468</guid>
		<description><![CDATA[<blockquote><p>You shouldn’t have to compromise the design or the user's experience to have selectable text.</p></blockquote><p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2009/javascript/the-state-of-selectable-text-replacement/">The state of selectable text-replacement</a></p>
]]></description>
			<content:encoded><![CDATA[<p>In &#8220;<a href="http://kilianvalkhof.com/2009/javascript/Cuf&oacute;n-vs-typefacejs-which-one-is-better/">Cufón vs. Typeface.js, which one is better?</a>&#8220;, I declared that the first one to support selectable text wins. We&#8217;re a couple of months further now and both <em>Typeselect</em> and <em>Typeface.js 0.13</em> appeared, adding support for selectable text. What is the state of selectable text-replacement?<span id="more-468"></span></p>
<h3>Typeselect</h3>
<p>Let&#8217;s take a look at the new kid on the block. <a href="http://typeselect.org">Typeselect</a> is based on version 0.12 of Typeface.js, and defines it&#8217;s goal boldly in a custom, text-selectable font on it&#8217;s homepage:</p>
<p><strong>You shouldn’t have to compromise the design or the user&#8217;s experience to have selectable text.</strong></p>
<p>Amen!</p>
<p>Typeselect acts as a layer above Typeface.js. You should take this as literal as possible, since the way Typeselect works is by adding transparent text on top of your replaced text. Script-wise, added to Typeface.js are <a href="http://jquery.com">jQuery 1.3.2</a> and their own js file, typeselect.js that takes care of the actual selection of text.</p>
<h3>Including Typeselect in your website</h3>
<pre><code>&lt;head&gt;
&hellip;
  &lt;script type="text/javascript" src="js/typeface-custom.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="fonts/nilland_regular.typeface.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="js/jquery-1.3.2.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="js/typeselect.js"&gt;&lt;/script&gt;
&hellip;
&lt;/head&gt;</code></pre>
<p>While it takes two more javascript files when compared to Typeface.js and Cuf&oacute;n, chances are that you already use jQuery and you can always choose to combine multiple javascript files. When we move on though, actually changing the font is pretty easy. By adding the class <code>select</code> to the elements you want to replace, and adding your typeface.js converted font to the css, the font will be replaced!</p>
<pre><code>&lt;div class="myclass <strong>select</strong>"&gt;
&hellip;
h1,  h2 {
  font-family:nilland, Georgia, Serif;
  font-style:italic;
}</code></pre>
<h3>Future?</h3>
<p>It seems that Typeselect aims to be a layer above typeface.js and Cuf&oacute;n to provide selectable text for both. Apart from that, better rendering of the fonts is on the <a href="http://www.typeselect.org/usage">roadmap</a> as well as a host of other things. Only&hellip; Typeface.js currently has it&#8217;s own, very similar, implementation of selectable text built right in. Actually, as far as I can see, it&#8217;s identical. So without Cuf&oacute;n support, I&#8217;m not sure if Typeselect is the best choice you can make.</p>
<h3>Typeface.js</h3>
<p>Typeface.js added text selection in version 0.13 in the same way as Typeselect: selectable text is implemented by overlaying real, transparent text on top of the rendered text. Pretty smart! AS you can see on <a href="http://typeface.neocracy.org/examples.html">Typeface.js&#8217; download page</a>, it works <em>really</em> well.</p>
<p>However, by doing this, performance goes down a bit. Not enough to really notice it, but if you want to disable it, there&#8217;s an <del>app</del> option for that. By adding the following to your &lt;head&gt; in a script element, selecting text gets disabled:</p>
<pre><code>_typeface_js.configure({ disableSelection: true })</code></pre>
<h3>Cuf&oacute;n?</h3>
<p>So, where does that leave Cuf&oacute;n? Well, text selection is <a href="http://github.com/sorccu/cufon/issues#issue/7">planned</a> in version 1.2. Right now Cuf&oacute;n is at version 1.08, so we&#8217;ll have to wait a little longer.</p>
<h3>Conclusion</h3>
<p>For now, <a href="http://typeface.neocracy.org">Typeface.js</a> is pretty much the best way to use good looking fonts while also allowing selectable text, cross-browser. However, with some work, @font-face can be made working in Firefox 3.5, Safari 3.1+, Opera 9+, Internet explorer 4+ and Chrome 0.3+. So, basically every browser. However, it is <a href="http://snook.ca/archives/html_and_css/becoming-a-font-embedding-master">a lot</a> of <a href="http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/">work</a> compared to using Typeface.js, Cuf&oacute;n or Typeselect. </p>
<p>Personally I think that in most browsers, using the javascript replacement results in better looking text, and it&#8217;s definitely easier to implement. In terms of forward compatibility, @font-face is a better choice. It&#8217;s up to you!</p>
<p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2009/javascript/the-state-of-selectable-text-replacement/">The state of selectable text-replacement</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bNa0wLqCp7g:ZBcCYMrQBiM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bNa0wLqCp7g:ZBcCYMrQBiM:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=bNa0wLqCp7g:ZBcCYMrQBiM:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bNa0wLqCp7g:ZBcCYMrQBiM:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=bNa0wLqCp7g:ZBcCYMrQBiM:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bNa0wLqCp7g:ZBcCYMrQBiM:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bNa0wLqCp7g:ZBcCYMrQBiM:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=bNa0wLqCp7g:ZBcCYMrQBiM:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bNa0wLqCp7g:ZBcCYMrQBiM:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bNa0wLqCp7g:ZBcCYMrQBiM:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=bNa0wLqCp7g:ZBcCYMrQBiM:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=bNa0wLqCp7g:ZBcCYMrQBiM:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Kilianvalkhofcom/~4/bNa0wLqCp7g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2009/javascript/the-state-of-selectable-text-replacement/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://kilianvalkhof.com/2009/javascript/the-state-of-selectable-text-replacement/</feedburner:origLink></item>
		<item>
		<title>gridBuilder.js, background grid generator in canvas</title>
		<link>http://feedproxy.google.com/~r/Kilianvalkhofcom/~3/81vySOl-csk/</link>
		<comments>http://kilianvalkhof.com/2009/design/gridbuilder-js-background-grid-generator-in-canvas/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 04:00:15 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=451</guid>
		<description><![CDATA[<blockquote><p>In order to correctly draw a 1px wide line, <em>on</em> a single pixel, you actually need to position it 0.5 pixel further.</p></blockquote><p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2009/design/gridbuilder-js-background-grid-generator-in-canvas/">gridBuilder.js, background grid generator in canvas</a></p>
]]></description>
			<content:encoded><![CDATA[<p>GridBuilder.js is a jQuery plugin that uses canvas to generate a grid background for arbitrary elements. Because it generates the grid via javascript and canvas, it&#8217;s much more flexible than using an image background.<span id="more-451"></span></p>
<h3>Canvas</h3>
<p>&hellip;is pretty easy. There are good guides available, not the least the one from Dive into HTML5, <a href="http://diveintohtml5.org/canvas.html">Let’s Call It A Draw(ing Surface)</a>. You need them, because there are a couple of gotcha&#8217;s. For example, to get different colored lines, you need to explicitly start new paths (but you don&#8217;t have to explicitly end them, just draw them on the canvas before starting another line). Once you get the way this works, it&#8217;s pretty much straightforward from there.</p>
<p>Another example is that in canvas, pixels are seen as small squares (yes, really.) When you draw a line from a pixel, it actually draws the line centered in the top-left corner of the pixel. When it renders, that means that the line gets blurred because it&#8217;s actually drawn on two pixels. This means that in order to correctly draw a 1px wide line, <em>on</em> a single pixel, you actually need to position it 0.5 pixel further. (so it&#8217;s in the &#8216;middle&#8217; of the pixel). It turns out, that sort of fails in Firefox (but not in Safari) because of a rounding error. If I used +0.5, Some lines just wouldn&#8217;t appear! However, if you just <strong>subtract 0.5</strong>, then everything works as expected.</p>
<h2><a href="http://gridbuilder.kilianvalkhof.com/">Download and demo</a></h2>
<p>The whole project is hosted at github as well: <a href="http://github.com/Kilian/gridBuilder.js">gridBuilder.js on Github</a>. gridBuilder.js is 4kb unpacked, uses jQuery and works in <strong>real browsers</strong>*. It&#8217;s dual licensed under the GPL and MIT licenses.</p>
<p>*A real browser here is defined as one that supports both <em>canvas</em> and <em>data-url&#8217;s</em>. The latter is being used to set the canvas as a background image for your element.</p>
<h3>Code</h3>
<p>Since it&#8217;s a <a href="http://jquery.com">jQuery</a> plugin, gridBuilder.js works for any jquery element. gridBuilder.js offers 5 customizable settings, a primary and secondary color for gridlines and secondary gridlines (positioned in the middle between two gridlines), a height for the vertical rhythm, a width for the horizontal strokes and a gutter (spacing) for between the strokes. </p>
<p>Entering <code>false</code> for any of the options will disable that particular option, so you can for example just have a vertical rhythm and no horizontal strokes, or disable the secondary gridlines. The default settings are shown below.</p>
<pre><code>$(document).ready(function(){
  $("body").gridBuilder({
    color:          '#eee',    // color of the primary gridlines
    secondaryColor: '#f9f9f9', // color of the secondary gridlines
    vertical:       18,        // height of the vertical rhythm
    horizontal:     140,       // width of horizontal strokes
    gutter:         40,        // width of the gutter between strokes
  });
});</code></pre>
<p>While this is a plugin you&#8217;d primarily use while building a website, should you want to remove it via javascript, you can call this function:</p>
<pre><code>$("body").destroyGrid();</code></pre>
<h3>Future improvements</h3>
<p>I would like to add a floating panel where you can enter all options and have the grid regenerate on the fly, as well as giving you the javascript code to invoke that particular grid. This would make it easier to tweak your grid, since you wouldn&#8217;t have to edit your file, save it and then refresh. </p>
<p>It&#8217;s hosted on <a href="http://github.com/Kilian/gridBuilder.js">Github</a>, so feel free to fork it and do with it whatever you like :)</p>
<p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2009/design/gridbuilder-js-background-grid-generator-in-canvas/">gridBuilder.js, background grid generator in canvas</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=81vySOl-csk:q_xeDGXv07M:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=81vySOl-csk:q_xeDGXv07M:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=81vySOl-csk:q_xeDGXv07M:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=81vySOl-csk:q_xeDGXv07M:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=81vySOl-csk:q_xeDGXv07M:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=81vySOl-csk:q_xeDGXv07M:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=81vySOl-csk:q_xeDGXv07M:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=81vySOl-csk:q_xeDGXv07M:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=81vySOl-csk:q_xeDGXv07M:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=81vySOl-csk:q_xeDGXv07M:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=81vySOl-csk:q_xeDGXv07M:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=81vySOl-csk:q_xeDGXv07M:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Kilianvalkhofcom/~4/81vySOl-csk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2009/design/gridbuilder-js-background-grid-generator-in-canvas/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://kilianvalkhof.com/2009/design/gridbuilder-js-background-grid-generator-in-canvas/</feedburner:origLink></item>
		<item>
		<title>Websites that don’t work without www</title>
		<link>http://feedproxy.google.com/~r/Kilianvalkhofcom/~3/saJaZk_F4Jw/</link>
		<comments>http://kilianvalkhof.com/2009/web/websites-that-dont-work-without-www/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 03:00:45 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=438</guid>
		<description><![CDATA[<blockquote><p>This was a fun little project I made in a couple of evenings.</p></blockquote><p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2009/web/websites-that-dont-work-without-www/">Websites that don&#8217;t work without www</a></p>
]]></description>
			<content:encoded><![CDATA[<p>One of my biggest internet-petpeeves is websites that force you to put <em>www.</em> in front of them. It&#8217;s 2009, so we should be able to get by with just the domain name, right? Wrong. There are still quite some websites that simply don&#8217;t work without www.<span id="more-438"></span></p>
<p>So I decided some action needed to be taken. I got the domainname <a href="http://websitesthatdontworkwithoutwww.com">websitesthatdontworkwithoutwww.com</a>, installed <a href="http://chyrp.net/">Chyrp</a>, got a <a href="http://thumbalizr.com/">Thumbalizr</a> API key and started making a list. <em>Name &#8216;em and shame &#8216;em!</em>. If any of the websites fix their non-www version, the without thumbnail will automatically update and I&#8217;ll add a link to their site :)</p>
<h3>Input time</h3>
<p>The site is there, and it has a couple of websites on it, but now I need your input to start adding more and more! If you encounter sites that don&#8217;t work without www., please send them to <a href="mailto:submit@websitesthatdontworkwithoutwww.com">submit@websitesthatdontworkwithoutwww.com</a>. You can also @reply the twitter account: <a href="http://twitter.com/wtdwww">@wtdwww</a>. (and better yet, follow it!)</p>
<h3>The Firefox thing</h3>
<p>During development I got a couple of remarks that &#8220;well, site X just works you know&#8221;, to which I could wittily (*ahem*) reply &#8220;Nope, it doesn&#8217;t. I bet you use Firefox 3.5!&#8221;. That&#8217;s because Firefox 3.5 automatically adds www. in front of domain names if they don&#8217;t work without. While this is awesome for end users, it just hides the fact that a lot of hosting providers/webmasters are incompetent at doing their jobs. In that regard it&#8217;s a shame.</p>
<p>Since I don&#8217;t want to just point and laught, fun as that is, I&#8217;ve also added a <a href="http://websitesthatdontworkwithoutwww.com/help">help</a> page, where some explanation of how to fix the non-www website will be placed. I&#8217;m still working on that, if you want you can help (just shoot me an e-mail!)</p>
<p>This was a fun little project I made in a couple of evenings. I still have to soften up some of the edges and tweak parts of the &#8220;site&#8221;, but overall I&#8217;m pretty happy with how easy it was to set up.</p>
<p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2009/web/websites-that-dont-work-without-www/">Websites that don&#8217;t work without www</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=saJaZk_F4Jw:E_VK5wo4lo4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=saJaZk_F4Jw:E_VK5wo4lo4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=saJaZk_F4Jw:E_VK5wo4lo4:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=saJaZk_F4Jw:E_VK5wo4lo4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=saJaZk_F4Jw:E_VK5wo4lo4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=saJaZk_F4Jw:E_VK5wo4lo4:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=saJaZk_F4Jw:E_VK5wo4lo4:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=saJaZk_F4Jw:E_VK5wo4lo4:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=saJaZk_F4Jw:E_VK5wo4lo4:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=saJaZk_F4Jw:E_VK5wo4lo4:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=saJaZk_F4Jw:E_VK5wo4lo4:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=saJaZk_F4Jw:E_VK5wo4lo4:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Kilianvalkhofcom/~4/saJaZk_F4Jw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2009/web/websites-that-dont-work-without-www/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://kilianvalkhof.com/2009/web/websites-that-dont-work-without-www/</feedburner:origLink></item>
		<item>
		<title>Graduation (almost)</title>
		<link>http://feedproxy.google.com/~r/Kilianvalkhofcom/~3/x3IvM3u844M/</link>
		<comments>http://kilianvalkhof.com/2009/life/graduation-almost/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 01:00:41 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
				<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=430</guid>
		<description><![CDATA[<blockquote><p>There was of course no way I was going through the hell of managing a 30-or-so page Word document</p></blockquote><p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2009/life/graduation-almost/">Graduation (almost)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Last week I started my Graduation project. For the next 16 weeks, I will be researching <strong>usability on social networks, with the goal of increased participation</strong> at <a href="http://wakoopa.com">Wakoopa</a>.<span id="more-430"></span></p>
<h3>LaTeX</h3>
<p>There was of course no way I was going through the hell of managing a 30-or-so page Word document. I decided to learn LaTeX (and BibTeX) which has powerful layout capabilities, and easy ways to keep track of all the references I use (within the document, and to other sources).</p>
<p>As it turns out, if you know HTML, LaTeX is really, really easy. </p>
<p>If you are a front-end developer that has to write documents every now and then, I&#8217;d definitively recommend you to start using it. It took me less then a day to get comfortable with it, and that included trying out a bunch of different editors. </p>
<h3>Source Control</h3>
<p>Because I use LaTeX, which is just plain text, it was a logical idea to just throw everything into a git repository. </p>
<p>Following that, I decided to place it on Github as well. This means I can work on it from any place that I want, that it&#8217;s securely backed-up, and that it&#8217;s really easy for others to read and suggest changes. <a href="http://alper.nl" lang="nl">Alper</a> went as far as <a href="http://twitter.com/alper/status/3403989928">submitting a patch</a>, <em>Very Cool</em>.</p>
<p>You can find my entire graduation project here: <a href="http://github.com/kilian/Graduation">Kilian/Graduation on GitHub</a>. I plan to make use of the issue tracker as well, and as you can see Issue #1 is: <a href="http://github.com/Kilian/Graduation/issues#issue/1">Graduate</a> ;)</p>
<p>While my entire graduation project will be done in Dutch, I will release an English article listing quick-wins and tips for increasing participation on social networks through usability at the end of the project as well. </p>
<p>So, wish me luck and we&#8217;ll see what comes out of it at the end of those 16 weeks! :)</p>
<p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2009/life/graduation-almost/">Graduation (almost)</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=x3IvM3u844M:SQKzqyn3LY0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=x3IvM3u844M:SQKzqyn3LY0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=x3IvM3u844M:SQKzqyn3LY0:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=x3IvM3u844M:SQKzqyn3LY0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=x3IvM3u844M:SQKzqyn3LY0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=x3IvM3u844M:SQKzqyn3LY0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=x3IvM3u844M:SQKzqyn3LY0:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=x3IvM3u844M:SQKzqyn3LY0:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=x3IvM3u844M:SQKzqyn3LY0:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=x3IvM3u844M:SQKzqyn3LY0:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=x3IvM3u844M:SQKzqyn3LY0:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=x3IvM3u844M:SQKzqyn3LY0:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Kilianvalkhofcom/~4/x3IvM3u844M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2009/life/graduation-almost/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://kilianvalkhof.com/2009/life/graduation-almost/</feedburner:origLink></item>
		<item>
		<title>Slides of my Fronteers talk</title>
		<link>http://feedproxy.google.com/~r/Kilianvalkhofcom/~3/xIQpxaVKTLU/</link>
		<comments>http://kilianvalkhof.com/2009/css-xhtml/slides-of-my-fronteers-talk/#comments</comments>
		<pubDate>Mon, 11 May 2009 05:00:22 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
				<category><![CDATA[CSS & (X)HTML]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=404</guid>
		<description><![CDATA[<blockquote><p>The presentation is a general overview of the current CSS frameworks, both client side and server side</p></blockquote><p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2009/css-xhtml/slides-of-my-fronteers-talk/">Slides of my Fronteers talk</a></p>
]]></description>
			<content:encoded><![CDATA[<p>On the 8th of may I gave a presentation on CSS frameworks at a <a href="http://fronteers.nl" lang="nl">Fronteers</a> meeting at Mirabeau in Eindhoven. I made the slides in <a href="http://prezi.com">Prezi</a> as an experiment, which proved to be a very interesting way of presenting.<span id="more-404"></span></p>
<h3>The presentation</h3>
<p><iframe src="http://prezi.com/52514/view" style="height:365px;width:560px;border:none;"></iframe><br />
<em>Or watch it here, if full screen is more of your thing: <a href="http://tinyurl.com/fronteerscss">CSS frameworks by Kilian Valkhof</a>. It&#8217;s in Dutch.</em></p>
<p>The presentation is a general overview of the current CSS frameworks, both client side and server side. It gives a rundown of the way they work, what their (dis)advantages are and which <a href="http://sencss.kilianvalkhof.com">one you should use</a>. Just kidding ;) </p>
<p>I managed to keep SenCSs out of the presentation, for its larger part. The most fun discovery was that very little people knew about the server-side options like sass and cssscaffold. They provide a powerful way to manage your CSS and allow you to write smarter css, faster. It&#8217;s where the cool stuff will be happening :)</p>
<p>Prezi was interesting to work with, even though <a href="http://getsatisfaction.com/zuilabs/topics/oops_trouble_with_your_prezi">their sloppy coding</a> prohibited me from making my presentation on my normal pc, a 64bit Ubuntu installation. It worked nicely in a 32bit VM though. Prezi, if you want a horde of smart, creative early adopters to use your product, pay me and I&#8217;ll fix your code ;) </p>
<h3>The Meeting</h3>
<p>Thanks to Martin for hosting the May meeting, Mirabeau in Eindhoven has an awesome looking office. It was our most southern meeting yet, and there were more people than I expected, so that was all good.</p>
<p>Besides my presentation, <a href="http://arjaneising.nl">Arjan Eising</a> gave a talk about WAI-ARIA. It was very interesting and he had some nice code examples, though I had hoped to hear a little bit more about the juxaposition between it and HTML5. </p>
<p>I also got rid of about 60 more stickers, which have been going like hot buns ever since they got the <a href="http://zeldman.com">Zeldman</a> <a href="http://www.flickr.com/photos/weblogmangrove/3353893961/">seal of approval</a>.</p>
<p>If you want to host a Fronteers meeting in the future, don&#8217;t hesitate to <a href="http://fronteers.nl/bijeenkomsten/organiseren" lang="nl">contact us</a>!</p>
<p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2009/css-xhtml/slides-of-my-fronteers-talk/">Slides of my Fronteers talk</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=xIQpxaVKTLU:2yzvRMUvwbo:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=xIQpxaVKTLU:2yzvRMUvwbo:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=xIQpxaVKTLU:2yzvRMUvwbo:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=xIQpxaVKTLU:2yzvRMUvwbo:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=xIQpxaVKTLU:2yzvRMUvwbo:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=xIQpxaVKTLU:2yzvRMUvwbo:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=xIQpxaVKTLU:2yzvRMUvwbo:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=xIQpxaVKTLU:2yzvRMUvwbo:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=xIQpxaVKTLU:2yzvRMUvwbo:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=xIQpxaVKTLU:2yzvRMUvwbo:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=xIQpxaVKTLU:2yzvRMUvwbo:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=xIQpxaVKTLU:2yzvRMUvwbo:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Kilianvalkhofcom/~4/xIQpxaVKTLU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2009/css-xhtml/slides-of-my-fronteers-talk/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://kilianvalkhof.com/2009/css-xhtml/slides-of-my-fronteers-talk/</feedburner:origLink></item>
		<item>
		<title>Combining Cufón and @font-face</title>
		<link>http://feedproxy.google.com/~r/Kilianvalkhofcom/~3/kUU1HAlYsds/</link>
		<comments>http://kilianvalkhof.com/2009/css-xhtml/combining-cufon-and-font-face/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 03:00:31 +0000</pubDate>
		<dc:creator>Kilian Valkhof</dc:creator>
				<category><![CDATA[CSS & (X)HTML]]></category>

		<guid isPermaLink="false">http://kilianvalkhof.com/?p=389</guid>
		<description><![CDATA[<blockquote><p>So, with an @font-face declaration in your CSS, and a bit of JavaScript telling you if the font is available, all you have to do is&#8230;</p></blockquote><p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2009/css-xhtml/combining-cufon-and-font-face/">Combining Cufón and @font-face</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Everyone wants @font-face to work everywhere, but as it stands, it only works in Safari and the upcoming versions of Firefox and Opera. In this article I&#8217;ll show you how to use <a href="http://cufon.shoqolate.com/generate/">Cufón</a> only if we can’t load the font through other, faster methods.<span id="more-389"></span></p>
<p>If you&#8217;re not familiar with Cufón, check out my previous article: <a href="http://kilianvalkhof.com/2009/javascript/cufon-vs-typefacejs-which-one-is-better/">Cufon vs. Typeface.js, which one is better?</a> or this article: <a href="http://www.cameronmoll.com/archives/2009/03/cufon_font_embedding/">Exploring Cufón, a sIFR alternative for font embedding</a> by Cameron Moll.</p>
<h3>Not just @font-face&hellip;</h3>
<p>Now, @font-face isn&#8217;t the only way to display custom fonts. What if the visitor already has the font installed? It&#8217;ll display automatically then, again leaving us with no reason to use load Cufón. These are the three options you have when you want to display custom fonts, in order of speed:</p>
<ul>
<li>The font is already installed on the users computer</li>
<li>The font get&#8217;s downloaded and displayed with the use of @font-face</li>
<li>The font gets replaced by Cufón</li>
</ul>
<p>I will not go into @font-face in this post, for more on web fonts, read these articles: <a href="http://www.alistapart.com/articles/cssatten">CSS at ten</a> and <a href="http://jontangerine.com/log/2008/10/font-face-in-ie-making-web-fonts-work">@font-face in IE: making web fonts work</a> (Which not only explains how to use @font-face in browsers that support it, but also in IE using their proprietary DRM-ed .eot &#8217;standard&#8217;.)</p>
<h3>The trick</h3>
<p>The effect of an installed font and using @font-face are the same: The font is rendered and displayed natively by the browser. This means that you only have to check <em>if the font is available</em>, and can forgo checking if @font-face is at all an option. A very smart solution to do this is the <a href="http://code.google.com/p/jquery-fontavailable/">jQuery fontAvailable</a> plugin. The implementation looks like this:</p>
<pre><code>$(document).ready(function() {
    if($.fontAvailable('Optimer')) {
        // code here
    }
});</pre>
<p></code><br />
The plugin works in a most ingenious way: On document load, it created an element with the alphabet in it, and sets the font-family to a non-existent font to apply the default font. It then replaces the font-family with the font you've specified, and checks if the width has changed. If the width has changed, that means the font was applied and is available.</p>
<p><strong>Update:</strong> <a href="http://dev.enekoalonso.com/">Eneko Alonso</a> ported the plugin to mootools: <a href="http://code.google.com/p/moo-fontavailable/">moo-fontavailable</a>. Cool no?</p>
<p>So, all you have to do to make this work, is make sure that <strong>the font-name you define in your @font-face declaration is the same as the real font name</strong>, and it will automatically work for both already installed fonts, and fonts loaded in with @font-face!</p>
<h3>And then Cufón</h3>
<p>So, with an @font-face declaration in your CSS, and a bit of JavaScript telling you if the font is available, all you have to do is add in @cufón when <code>$.fontAvailable</code> returns false! (Note the added ! in the example code, so Cufón gets executed if the font is <strong>not</strong> available)</p>
<pre><code>$(document).ready(function() {
    if(<strong>!</strong>$.fontAvailable('Optimer')) {
      Cufon.replace('h1');
    }
});</pre>
<p></code></p>
<p>Unfortunately it's not <em>quite</em> that easy. Because IE can show a <abbr title="Flash Of Unstyled Content">FOUC</abbr> with Cufón, you have to add <code>Cufon.now();</code> at the end of the page. If we use Cufón from within <code>$(document).ready();</code>, that would make <code>Cufon.now();</code> ineffective because it would actually be parsed before the document is ready, and thus before the initial <code>Cufon.replace();</code> function.</p>
<p>It will still work, but IE users might see the font getting changed while the page is loaded. Over at the Google group, they are already working on a <a href="http://groups.google.com/group/cufon/browse_thread/thread/a9ee5d7e8984bfba/8b22afa9fb6975de">solution</a> to this, so it shouldn't be long before you won't need <code>Cufon.now();</code> at all anymore.</p>
<h3>That's all there is to it</h3>
<p>All in all, it's quite simple. Check if the font is available, either through already being installed or through @font-face, and if it isn't, we'll let Cufón display it. This offers you the best of both worlds, because browsers that support @font-face will have their native text, and browsers without @font-face support will still get custom fonts. </p>
<p>This article is written by Kilian Valkhof, Front-end developer & User experience designer. Please visit <a href="http://kilianvalkhof.com">KilianValkhof.com</a> for more articles!<br/><br/><a href="http://kilianvalkhof.com/2009/css-xhtml/combining-cufon-and-font-face/">Combining Cufón and @font-face</a></p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=kUU1HAlYsds:SVGAdX_JDro:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=kUU1HAlYsds:SVGAdX_JDro:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=kUU1HAlYsds:SVGAdX_JDro:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=kUU1HAlYsds:SVGAdX_JDro:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=kUU1HAlYsds:SVGAdX_JDro:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=kUU1HAlYsds:SVGAdX_JDro:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=kUU1HAlYsds:SVGAdX_JDro:gIN9vFwOqvQ"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=kUU1HAlYsds:SVGAdX_JDro:gIN9vFwOqvQ" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=kUU1HAlYsds:SVGAdX_JDro:l6gmwiTKsz0"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=l6gmwiTKsz0" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=kUU1HAlYsds:SVGAdX_JDro:TzevzKxY174"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?d=TzevzKxY174" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?a=kUU1HAlYsds:SVGAdX_JDro:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/Kilianvalkhofcom?i=kUU1HAlYsds:SVGAdX_JDro:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/Kilianvalkhofcom/~4/kUU1HAlYsds" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://kilianvalkhof.com/2009/css-xhtml/combining-cufon-and-font-face/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		<feedburner:origLink>http://kilianvalkhof.com/2009/css-xhtml/combining-cufon-and-font-face/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.175 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-03-04 20:19:42 -->
