<?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>Impressive Webs</title>
	
	<link>http://www.impressivewebs.com</link>
	<description>Web Design Articles &amp; Tutorials. To make the web impressive.</description>
	<lastBuildDate>Wed, 16 May 2012 16:58:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/ImpressiveWebs" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="impressivewebs" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">ImpressiveWebs</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Some Random JavaScript Coding Tidbits</title>
		<link>http://www.impressivewebs.com/random-javascript-coding-tidbits/</link>
		<comments>http://www.impressivewebs.com/random-javascript-coding-tidbits/#comments</comments>
		<pubDate>Wed, 16 May 2012 10:00:44 +0000</pubDate>
		<dc:creator>Louis Lazaris</dc:creator>
				<category><![CDATA[JavaScript & jQuery]]></category>
		<category><![CDATA[Web Design Tutorials]]></category>

		<guid isPermaLink="false">http://www.impressivewebs.com/?p=6798</guid>
		<description><![CDATA[<img src="http://cdn.impressivewebs.com/2012-05/js-tidbits.jpg" alt="Some Random JavaScript Coding Tidbits" title="Some Random JavaScript Coding Tidbits" width="184" height="184" class="article_image">Although my knowledge of HTML and CSS seems somewhat rounded and complete, I don't feel the same way about JavaScript. I always seem to be learning something new, or else reminding myself of stuff I might have learned years ago but have forgotten.

So here are a few things I've recently learned or read about that might be useful to you.]]></description>
			<content:encoded><![CDATA[<p><img src="http://cdn.impressivewebs.com/2012-05/js-tidbits.jpg" alt="Some Random JavaScript Coding Tidbits" title="Some Random JavaScript Coding Tidbits" width="184" height="184" class="article_image">Although my knowledge of HTML and CSS seems somewhat rounded and complete, I don&#8217;t feel the same way about JavaScript. I always seem to be learning something new, or else reminding myself of stuff I might have learned years ago but have forgotten.</p>
<p>So here are a few things I&#8217;ve recently learned or read about that might be useful to you.</p>
<h2>Functions With Optional Arguments</h2>
<p>Have you ever done the following, or something like it:</p>
<pre name="code" class="js">
alert("hello world!");
</pre>
<p>Wow, that&#8217;s complex stuff, huh? Well, as you probably know, the <code>alert()</code> function is built into the language. You generally pass a single argument into the <code>alert()</code> function, and the browser will throw a pop-up message to the user displaying the message passed in.</p>
<p>But what happens if you do this:</p>
<pre name="code" class="js">
alert("hello world!", "How you doin'?");
</pre>
<p>You might assume one of two things should happen: (1) Two consecutive alerts showing the same message, or (2) an error with no alert. But the answer is neither. Instead, the result is exactly the same as the first example that has only one argument.</p>
<p>The reason for this is that, in JavaScript, function calls can accept an unlimited number of arguments &#8212; even if the defined function itself only processes one or two (as in the case of <code>alert()</code>).</p>
<p>So what does this mean? Well, this has its pros and cons. If someone mistakenly adds an extra argument to a function call that will only deal with a certain number of arguments, they could be left scratching their heads over why the argument isn&#8217;t being processed, since no error informs them of the problem.</p>
<p>On the plus side, this allows you to write functions that accept optional arguments, and then write  code to deal with this accordingly. This happens all the time in jQuery, and it&#8217;s something that can make your functions more flexible.</p>
<h2>Redefining Native Objects</h2>
<p>While we&#8217;re on the topic of <code>alert()</code>, here&#8217;s another thing it might be useful to know. Try this:</p>
<pre name="code" class="js">
function alert(myvalue) {
    document.write(myvalue);
}

alert('hello world');​​​​
</pre>
<p>To save you the trouble, here it is <a href="http://jsfiddle.net/9WGzC/">in a fiddle</a>.</p>
<p>In this example, we&#8217;ve redefined the <code>alert()</code> function so that instead of the message being displayed in a customary alert dialog, the <code>alert()</code> function writes the message onto the page. In the past, this also meant you could redefine other values, like the <code>undefined</code> property.</p>
<p>Try the following example in an older browser like IE8:</p>
<pre name="code" class="js">
var undefined = 'hahaha';
var myvar;

if (myvar === undefined) {
    alert('it is undefined');
} else {
    alert('it is defined');
}
</pre>
<p>Although the <code>myvar</code> variable has not yet been defined, when we check to see if it&#8217;s equal to &#8220;undefined&#8221;, the <code>if-else</code> statement resolves to tell us that &#8220;it is defined&#8221;. This is because of what we did on the first line of that code block: We redefined &#8220;undefined&#8221;.</p>
<div class="update-box"><b>Update</b>: As pointed out in the comments, being able to redefine certain properties like &#8220;undefined&#8221; is no longer possible in ECMAScript 5 compliant browsers. But this does work in an older browser, like IE8.</div>
<h2>Comparing Strings Like Numbers</h2>
<p>You probably have done numeric comparisons before using greater-than or less-than operators (&#8220;&gt;&#8221; and &#8220;&lt;&#8221;). And if you&#8217;ve wanted to compare two strings, you&#8217;ll just check to see if they&#8217;re equal. But you can also do this:</p>
<pre name="code" class="js">
if ('baseball' > 'football') {
    alert('baseball rules!');
}​​​​​​​​​ else {
    alert('football rules!');
}​
</pre>
<p>Notice that I&#8217;m checking to see if the string &#8220;baseball&#8221; is greater than the string &#8220;football&#8221;. Unfortunately, JavaScript doesn&#8217;t know anything about sports. Baseball is obviously much greater than football. But in this case, the result will be an alert message of &#8220;football rules!&#8221;. <a href="http://jsfiddle.net/46FCX/">Try it</a>.</p>
<p>So how does the browser calculate which string is greater? Well, it simply assigns a number value to each letter and then checks to see which number result is greater. To make the baseball/football comparison return a positive alert for us baseball fans, all we have to do is convert the first character in the string &#8220;football&#8221; to uppercase, <a href="http://jsfiddle.net/46FCX/2/">like this</a>:</p>
<pre name="code" class="js">
if ('baseball' > 'Football') {
    alert('baseball rules!');
} else {
    alert('football rules!');
}
</pre>
<p>Uppercase letters are viewed as lower in value than lowercase letters, so now the <code>if-else</code> statement will return the correct result &#8212; that baseball is in fact greater than football.</p>
<p>Again, this is not necessarily something that you&#8217;ll be using any time soon. It&#8217;s not often you have to compare strings in this way. But it&#8217;s good to know that it is possible should the need for such a computation ever arise.</p>
<h2>More Like This?</h2>
<p>What do you think of these types of posts? I normally don&#8217;t cover JavaScript as much as I do CSS. But I would like to publish stuff I pick up here and there, if for no other reason than to have a reference of my own to use. Your thoughts are welcome &#8212; especially if anything I&#8217;ve said here is incorrect.</p>
 <img src="http://www.impressivewebs.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=6798" width="1" height="1" style="display: none;" /><p>Related posts:<ol>
<li><a href='http://www.impressivewebs.com/callback-functions-javascript/' rel='bookmark' title='Callback Functions in JavaScript'>Callback Functions in JavaScript</a></li>
<li><a href='http://www.impressivewebs.com/css3-transitions-javascript/' rel='bookmark' title='Triggering CSS3 Transitions With JavaScript'>Triggering CSS3 Transitions With JavaScript</a></li>
<li><a href='http://www.impressivewebs.com/ie6-progressive-enhancement/' rel='bookmark' title='Coding for IE6 = Progressive Enhancement'>Coding for IE6 = Progressive Enhancement</a></li>
</ol></p>
<p><a href="http://feedads.g.doubleclick.net/~a/Bkma8NjF9cxVeNnBz98a3p7DQXs/0/da"><img src="http://feedads.g.doubleclick.net/~a/Bkma8NjF9cxVeNnBz98a3p7DQXs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/Bkma8NjF9cxVeNnBz98a3p7DQXs/1/da"><img src="http://feedads.g.doubleclick.net/~a/Bkma8NjF9cxVeNnBz98a3p7DQXs/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=65byDUXutJc:AMyYRGt-lJ0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=65byDUXutJc:AMyYRGt-lJ0:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?i=65byDUXutJc:AMyYRGt-lJ0:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ImpressiveWebs/~4/65byDUXutJc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.impressivewebs.com/random-javascript-coding-tidbits/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>The Folly of Allowing Up/Down Voting for Individual Comments</title>
		<link>http://www.impressivewebs.com/folly-up-down-voting-comments/</link>
		<comments>http://www.impressivewebs.com/folly-up-down-voting-comments/#comments</comments>
		<pubDate>Tue, 15 May 2012 10:00:20 +0000</pubDate>
		<dc:creator>Louis Lazaris</dc:creator>
				<category><![CDATA[Blogging]]></category>

		<guid isPermaLink="false">http://www.impressivewebs.com/?p=6782</guid>
		<description><![CDATA[<img src="http://cdn.impressivewebs.com/2012-05/folly-voting-comments.jpg" alt="The Folly of Allowing Up/Down Voting for Individual Comments" title="The Folly of Allowing Up/Down Voting for Individual Comments" width="184" height="184" class="article_image">We should be past this type of behaviour already. This industry should be about sharing, learning, and growing in knowledge. But too often we do things that allow these areas to be stifled. And it turns people away, causing newcomers to become discouraged and not want to voice their opinions and questions for fear that they'll be labelled "stupid".

Of course, we're all going to slip up in this regard to some degree. I've answered people's questions on this blog in ways that some people thought were rude and condescending. It wasn't my intent to do that, so I've tried to do my best to apologize and keep the conversation going.]]></description>
			<content:encoded><![CDATA[<p>We should be past this type of behaviour already. This industry should be about sharing, learning, and growing in knowledge. But too often we do things that allow these areas to be stifled. And it turns people away, causing newcomers to become discouraged and not want to voice their opinions and questions for fear that they&#8217;ll be labelled &#8220;stupid&#8221;.</p>
<p>Of course, we&#8217;re all going to slip up in this regard to some degree. I&#8217;ve answered people&#8217;s questions on this blog in ways that some people thought were rude and condescending. It wasn&#8217;t my intent to do that, so I&#8217;ve tried to do my best to apologize and keep the conversation going.</p>
<p>When Smashing Magazine added up/down voting for individual comments on their site, I <a href="https://twitter.com/#!/impressivewebs/status/13427023665963008">expressed my displeasure</a> over that decision. When they asked me why, I <a href="https://twitter.com/#!/impressivewebs/status/13427023665963008">explained</a>:</p>
<blockquote class="twitter-tweet" data-in-reply-to="13419297321779200"><p>@<a href="https://twitter.com/smashingmag">smashingmag</a> In theory, the vote up/down is perfect. But in practice, it is anything but, because it&#8217;s just another outlet for abuse.</p>
<p>&mdash; Louis Lazaris (@ImpressiveWebs) <a href="https://twitter.com/ImpressiveWebs/status/13427023665963008" data-datetime="2010-12-11T02:57:06+00:00">December 11, 2010</a></p></blockquote>
<p><script src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
<p>Proof of this &#8220;abuse&#8221; was demonstrated in a recent Smashing Magazine article where <a href="http://coding.smashingmagazine.com/2012/05/09/building-real-time-commenting-system/#comment-579079">a harmless question</a> was down-voted more than 30 times. Here&#8217;s a screen grab of the comment along with the down votes:</p>
<p><img src="http://cdn.impressivewebs.com/2012-05/sm-comment-downvote.jpg" alt="Smashing Magazine's up/down voting for comments" title="Smashing Magazine's up/down voting for comments" width="680" height="173" class="wide_image wi_new"></p>
<p>A couple of days before I took that screen shot, the number of downvotes were even higher, at around 35 or so. As you can see from the green &#8220;up&#8221; thumb, I up-voted the comment.</p>
<h2>Are We Scaring Away Newcomers?</h2>
<p>If we abuse simple questions in this way, then we&#8217;re basically closing the door to allowing new designers and developers to interact with those of us who are more experienced in this field. The good thing is, a few Smashing Magazine readers took exception to the way that comment was down-voted and pointed out how stupid it is to down-vote a simple question.</p>
<p>Maybe the person who posted that question is actually an experienced developer and he&#8217;s just always done things a certain way, and was curious as to why the author of the article chose a different method. I don&#8217;t think there&#8217;s anything wrong with that. But if the commenter is a newcomer to the field of web design, then it&#8217;s worse.</p>
<p>Now this person could be too embarrassed to ever post another comment again for fear of being down-voted into the Hall of Stupidity by a bunch of YouTube-trained egomaniacs. And who knows how many other newcomers will now be too scared to post a comment (especially not with their real name) on Smashing Magazine posts. I think that would be a sad outcome that could easily be resolved by never allowing individual comments to be voted on in a niche industry like ours.</p>
<p>But that doesn&#8217;t mean that you can&#8217;t reward commenters. As shown below, on <a href="http://css-tricks.com">CSS-Tricks</a>, Chris Coyier gives a star to good comments &#8212; just like we got in Kindergarten when we drawed goodly pictures! :)</p>
<p><img src="http://cdn.impressivewebs.com/2012-05/css-tricks-comments.jpg" alt="Rewarded comments on CSS-Tricks" title="Rewarded comments on CSS-Tricks" width="680" height="173" class="wide_image wi_new"></p>
<p>Thus I propose that blogs should do one of two things:</p>
<ul class="body_list">
<li>No up/down voting on comments</li>
<li>Have a moderator-driven rewards system</li>
</ul>
<p>This keeps things positive, and will not scare away people who want to ask simple questions, or people who want to voice their support for Flash, or Microsoft &#8212; or other types of comments that are viewed as &#8220;stupid&#8221;.</p>
 <img src="http://www.impressivewebs.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=6782" width="1" height="1" style="display: none;" /><p>Related posts:<ol>
<li><a href='http://www.impressivewebs.com/conditional-comments/' rel='bookmark' title='Things You Might Not Know About Conditional Comments'>Things You Might Not Know About Conditional Comments</a></li>
<li><a href='http://www.impressivewebs.com/conditional-comments-classes-ie/' rel='bookmark' title='Don&#8217;t Use Conditional Comments to Create Classes for IE7+'>Don&#8217;t Use Conditional Comments to Create Classes for IE7+</a></li>
<li><a href='http://www.impressivewebs.com/gray-area-comment-spam/' rel='bookmark' title='Dealing With Gray-area Comment Spam'>Dealing With Gray-area Comment Spam</a></li>
</ol></p>
<p><a href="http://feedads.g.doubleclick.net/~a/WU1va-YaO9mbR74e_qQX2PBZD_k/0/da"><img src="http://feedads.g.doubleclick.net/~a/WU1va-YaO9mbR74e_qQX2PBZD_k/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/WU1va-YaO9mbR74e_qQX2PBZD_k/1/da"><img src="http://feedads.g.doubleclick.net/~a/WU1va-YaO9mbR74e_qQX2PBZD_k/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=8I1e5LQE8K0:Ttpx3MyGfsw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=8I1e5LQE8K0:Ttpx3MyGfsw:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?i=8I1e5LQE8K0:Ttpx3MyGfsw:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ImpressiveWebs/~4/8I1e5LQE8K0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.impressivewebs.com/folly-up-down-voting-comments/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Web Designer Magazine Feature</title>
		<link>http://www.impressivewebs.com/web-designer-magazine-feature/</link>
		<comments>http://www.impressivewebs.com/web-designer-magazine-feature/#comments</comments>
		<pubDate>Mon, 14 May 2012 10:00:45 +0000</pubDate>
		<dc:creator>Louis Lazaris</dc:creator>
				<category><![CDATA[Web Design Articles]]></category>

		<guid isPermaLink="false">http://www.impressivewebs.com/?p=6731</guid>
		<description><![CDATA[<img src="http://cdn.impressivewebs.com/2012-05/web-designer-feature.jpg" alt="Web Designer Magazine Feature" title="Web Designer Magazine Feature" width="184" height="184" class="article_image">If you keep up on print magazine reading in the industry, you probably know that <cite>.net magazine</cite> and <cite>Web Designer Magazine</cite> are basically the only two print magazines specifically targeted at web designers (at least, the only two that I know of).

So recently, <cite>Web Designer</cite> contacted me to do a feature piece covering CSS3 techniques. The focus of the piece is CSS effects that, prior to CSS3, required the use of images or scripts. The feature (called "Master CSS Effects) was planned to have 30 CSS techniques, and I was responsible for covering 20 of them. I don't know what the final count includes, as I haven't yet seen the issue, but the magazines's staff were responsible for any remaining tips. They also wrote the intro and conclusion.]]></description>
			<content:encoded><![CDATA[<p>If you keep up on print magazine reading in the industry, you probably know that <a href="http://www.netmagazine.com/">.net magazine</a> and <a href="http://www.webdesignermag.co.uk/blog/web-designer-issue-196-now-on-sale/">Web Designer Magazine</a> are basically the only two print magazines specifically targeted at web designers (at least, the only two that I know of).</p>
<p>Recently, <cite>Web Designer</cite> contacted me to do a feature piece covering CSS3 techniques. The focus of the piece is CSS effects that, prior to CSS3, required the use of images or scripts. The feature (called &#8220;Master CSS Effects&#8221;) was planned to have 30 CSS techniques, and I was responsible for covering 20 of them. I don&#8217;t know what the final count includes, as I haven&#8217;t yet seen the issue, but the magazines&#8217;s staff were responsible for any remaining tips. They also wrote the intro and conclusion.</p>
<p><a href="http://www.webdesignermag.co.uk/blog/web-designer-issue-196-now-on-sale/"><img src="http://cdn.impressivewebs.com/2012-05/web-designer-mag-cover.jpg" alt="Web Designer Magazine Feature" title="Web Designer Magazine Feature" width="680" height="516" class="wide_image wi_new"></a></p>
<p>The feature includes techniques for CSS Ribbons, tilt-shift text, CSS tooltips, anaglyphic text, and lots more, with some that are more run-of-the mill like multiple backgrounds and rounded corners.</p>
<p>This is officially my first foray into writing for a print magazine. It was fun and pretty much the same as writing stuff online, and I would definitely do it again. Check out the description of the article at the link below or by clicking the image above.</p>
<p><a href="http://www.webdesignermag.co.uk/blog/web-designer-issue-196-now-on-sale/">Web Designer 196 now on sale</a></p>
 <img src="http://www.impressivewebs.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=6731" width="1" height="1" style="display: none;" /><p>Related posts:<ol>
<li><a href='http://www.impressivewebs.com/new-css3-click-chart/' rel='bookmark' title='The All-New CSS3 Click Chart'>The All-New CSS3 Click Chart</a></li>
<li><a href='http://www.impressivewebs.com/screencast-series-html5-css3/' rel='bookmark' title='Screencast Series on HTML5 and CSS3'>Screencast Series on HTML5 and CSS3</a></li>
<li><a href='http://www.impressivewebs.com/youre-not-stuck-in-a-cookie-cutter-design/' rel='bookmark' title='You&#8217;re Not Stuck in a Cookie Cutter Design!'>You&#8217;re Not Stuck in a Cookie Cutter Design!</a></li>
</ol></p>
<p><a href="http://feedads.g.doubleclick.net/~a/G2HozMaF2v6m82g82I77ovOCuhs/0/da"><img src="http://feedads.g.doubleclick.net/~a/G2HozMaF2v6m82g82I77ovOCuhs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/G2HozMaF2v6m82g82I77ovOCuhs/1/da"><img src="http://feedads.g.doubleclick.net/~a/G2HozMaF2v6m82g82I77ovOCuhs/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=-qFk0J_sVXY:Lfwf2879JnA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=-qFk0J_sVXY:Lfwf2879JnA:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?i=-qFk0J_sVXY:Lfwf2879JnA:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ImpressiveWebs/~4/-qFk0J_sVXY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.impressivewebs.com/web-designer-magazine-feature/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML9 Boilerstrap: The Story and the Unexpected Explosion</title>
		<link>http://www.impressivewebs.com/html9-boilerstrap-story/</link>
		<comments>http://www.impressivewebs.com/html9-boilerstrap-story/#comments</comments>
		<pubDate>Thu, 10 May 2012 10:00:43 +0000</pubDate>
		<dc:creator>Louis Lazaris</dc:creator>
				<category><![CDATA[Web Design Articles]]></category>

		<guid isPermaLink="false">http://www.impressivewebs.com/?p=6711</guid>
		<description><![CDATA[<img src="http://cdn.impressivewebs.com/2012-05/h9-boilerstrap.jpg" alt="HTML9 Boilerstrap" title="HTML9 Boilerstrap" width="184" height="184" class="article_image">For a while now I've been wanting to set aside some time to do some sort of web development parody. I've done this sort of thing before and it's fun to see people's reactions.

I knew it had to be something centered around the 'framework' movement, mainly poking fun at the well-known HTML5 Boilerplate project. So on Tuesday night this week, I took the idea of HTML9 Responsive Boilerstrap JS from concept to creation. I finished it that night, including registering the domain, setting up the site, and gritclonemerging its own bogus repo.]]></description>
			<content:encoded><![CDATA[<p><img src="http://cdn.impressivewebs.com/2012-05/h9-boilerstrap.jpg" alt="HTML9 Boilerstrap" title="HTML9 Boilerstrap" width="184" height="184" class="article_image">For a while now I&#8217;ve been wanting to set aside some time to do some sort of web development parody. I&#8217;ve done <a href="http://www.webdesignerdepot.com/2010/03/how-to-kill-the-design-community/">this sort of thing</a> <a href="http://www.webdesignerdepot.com/2010/08/how-to-make-an-internet-web-page/">before</a> and it&#8217;s fun to see people&#8217;s reactions.</p>
<p>I knew it had to be something centered around the &#8216;framework&#8217; movement, mainly poking fun at the well-known <a href="http://html5boilerplate.com">HTML5 Boilerplate</a> project. So on Tuesday night this week, I took the idea of <a href="http://html9responsiveboilerstrapjs.com/">HTML9 Responsive Boilerstrap JS</a> from concept to creation. I finished it that night, including registering the domain, setting up the site, and <a href="http://html9responsiveboilerstrapjs.com/">gritclonemerging its own bogus repo</a>.</p>
<p>It&#8217;s really not a hugely complex site &#8212; there&#8217;s not a single script on the page, just CSS. Some people found it interesting that someone would choose to spend &#8216;so much time&#8217; on a nothing project like this. This is definitely not like me. I rarely have time for this kind of goofing off. But it was just 3 or 4 hours of work, plus a few adjustments afterwards.</p>
<h2>The Crazy Stats</h2>
<p>I wasn&#8217;t even sure when I would officially make the site public. I was thinking of doing it next week some time. But it was pretty much done, and it was early in the day on Wednesday, so I decided to <a href="https://twitter.com/#!/ImpressiveWebs/status/200245291373441025">tweet it</a> at around 11:30am Eastern time. I thought maybe a few hundred of my followers would pick it up, have a laugh, and maybe share it with a few people.</p>
<p>But the result was astounding. Within <a href="https://twitter.com/#!/ImpressiveWebs/status/200288961036423169">just a few hours</a>, Google Analytics for the site was showing over 30,000 page views. To give you a comparison, Impressive Webs usually gets around 10,000 page views, on a good day &#8212; and that&#8217;s a <em>full</em> day. As I write this article (shortly before midnight on Wednesday evening), H9RBS.js as had over 70,000 page views.</p>
<div class="update-box"><strong>Update:</strong> 24 hours after the original tweet, the site is now up to over 100,000 page views. A <a href="https://twitter.com/#!/wired/status/200441420455227392">tweet</a> from <a href="https://twitter.com/#!/wired">a tech publication</a> that has 1.4 million Twitter followers certainly helps.</div>
<h2>Why Did It Spread So Fast?</h2>
<p>I didn&#8217;t do anything to promote this. Just a single measly tweet to my modest 6,000 followers. No blog post, no submission to <a href="http://hackerne.ws/">Hacker News</a> or Reddit or anything else. Normally when I tweet a link, if 100 people click the link, that&#8217;s considered a huge success (as far as Twitter CTR). But somehow, within 30 minutes this one had gone ballistic, and everybody was re-tweeting it.</p>
<div class="update-box"><strong>Update (May 11, 2012):</strong> I figured out that it had to be <a href="http://twitter.com/#!/chriscoyier/status/200247035125972992">Chris Coyier&#8217;s tweet</a> that got the ball rolling. I had <a href="http://twitter.com/#!/ImpressiveWebs/status/200245291373441025">tweeted about Boilerstrap</a> at around 11:26am, and his tweet was 6 minutes later. Many other big-name designers and developers follow Chris, so&#8230;</a>
</div>
<p>I don&#8217;t want to explain exactly why I personally found this concept funny. I probably don&#8217;t have to explain it; I think it&#8217;s obvious to most people.</p>
<p>But why did this subject seem to strike a chord with just about every designer/developer/agency/programmer on Twitter? I&#8217;m curious to hear what others think.</p>
 <img src="http://www.impressivewebs.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=6711" width="1" height="1" style="display: none;" /><p>Related posts:<ol>
<li><a href='http://www.impressivewebs.com/browser-usage-stats/' rel='bookmark' title='What&#8217;s the Best Source for Browser Usage Stats?'>What&#8217;s the Best Source for Browser Usage Stats?</a></li>
<li><a href='http://www.impressivewebs.com/book-giveaway-ruby/' rel='bookmark' title='Book Giveaway: The Book of Ruby'>Book Giveaway: The Book of Ruby</a></li>
<li><a href='http://www.impressivewebs.com/book-giveaway-html5-css3/' rel='bookmark' title='Book Giveaway: HTML5 &amp; CSS3 for the Real World'>Book Giveaway: HTML5 &#038; CSS3 for the Real World</a></li>
</ol></p>
<p><a href="http://feedads.g.doubleclick.net/~a/yEXaoHj-3PNBuEzPrXn5t_bQ9w4/0/da"><img src="http://feedads.g.doubleclick.net/~a/yEXaoHj-3PNBuEzPrXn5t_bQ9w4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/yEXaoHj-3PNBuEzPrXn5t_bQ9w4/1/da"><img src="http://feedads.g.doubleclick.net/~a/yEXaoHj-3PNBuEzPrXn5t_bQ9w4/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=NO1TbyisXdw:mcD01adjJlM:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=NO1TbyisXdw:mcD01adjJlM:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?i=NO1TbyisXdw:mcD01adjJlM:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ImpressiveWebs/~4/NO1TbyisXdw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.impressivewebs.com/html9-boilerstrap-story/feed/</wfw:commentRss>
		<slash:comments>45</slash:comments>
		</item>
		<item>
		<title>CSS/HTML Tools and Resources Worth Checking Out</title>
		<link>http://www.impressivewebs.com/css-html-tools-resources/</link>
		<comments>http://www.impressivewebs.com/css-html-tools-resources/#comments</comments>
		<pubDate>Wed, 09 May 2012 10:00:09 +0000</pubDate>
		<dc:creator>Louis Lazaris</dc:creator>
				<category><![CDATA[Roundups & Resources]]></category>

		<guid isPermaLink="false">http://www.impressivewebs.com/?p=6682</guid>
		<description><![CDATA[<img src="http://cdn.impressivewebs.com/2012-05/css-html-tools.jpg" alt="CSS and HTML Tools and Resources Worth Checking Out" title="CSS and HTML Tools and Resources Worth Checking Out" width="184" height="184" class="article_image">As always, my collection of recently discovered links, tools, resources and libraries keeps growing.

To archive these for my own purposes, and to share them in bulk, here is a list of CSS, HTML, and related tools that might be of interest to readers.]]></description>
			<content:encoded><![CDATA[<p>As always, my collection of recently discovered links, tools, resources and libraries keeps growing. To archive these for my own purposes, and to share them in bulk, here is a list of CSS, HTML, and related tools that might be of interest to readers.</p>
<h2><a href="http://cssfontstack.com/">CSS Font Stack</a></h2>
<p><a href="http://cssfontstack.com/"><img src="http://cdn.impressivewebs.com/2012-05/css-font-stack.jpg" alt="CSS Font Stack" title="CSS Font Stack" width="680" height="200" class="wide_image wi_new"></a><br />
A simple tool to let you choose what CSS font stack to use. Also gives you Mac and Windows compatibility for each stack and includes stacks for serif, sans-serif, and monospaced fonts.</p>
<h2><a href="http://ffffallback.com/">FFFFALLBACK</a></h2>
<p><a href="http://ffffallback.com/"><img src="http://cdn.impressivewebs.com/2012-05/ffffallback.jpg" alt="FFFFALLBACK" title="FFFFALLBACK" width="680" height="200" class="wide_image wi_new"></a><br />
FFFFALLBACK is a bookmarklet that lets you easily find fallback fonts for your web fonts to ensure that your designs degrade gracefully.</p>
<h2><a href="http://craigwaterman.github.com/Hoodie/">Hoodie</a></h2>
<p><a href="http://craigwaterman.github.com/Hoodie/"><img src="http://cdn.impressivewebs.com/2012-05/hoodie.jpg" alt="Hoodie" title="Hoodie" width="680" height="200" class="wide_image wi_new"></a><br />
&#8220;Hoodie aims to combine the best of the best frameworks into a single package to speed your development.&#8221; Includes portions of Twitter Bootstrap, Meyer reset, Normalize.css, Selectivzr, HTML5 Boilerplate, and more.</p>
<h2><a href="http://thehtml5quiz.com/">HTML5 Elements Quiz</a></h2>
<p><a href="http://thehtml5quiz.com/"><img src="http://cdn.impressivewebs.com/2012-05/html5-quiz.jpg" alt="HTML5 Elements Quiz" title="HTML5 Elements Quiz" width="680" height="200" class="wide_image wi_new"></a><br />
Pretty simple. A game to test how many valid HTML5 elements you can name. This isn&#8217;t just the new elements, but any element that&#8217;s valid with an HTML5 doctype.</p>
<h2><a href="http://simurai.com/tagged/lab">simurai&#8217;s CSS lab</a></h2>
<p><a href="http://simurai.com/tagged/lab"><img src="http://cdn.impressivewebs.com/2012-05/simurai-labs.jpg" alt="simurai's CSS lab" title="simurai's CSS lab" width="680" height="200" class="wide_image wi_new"></a><br />
Simurai is a web developer based in Amsterdam. He&#8217;s one of these somewhat mysterious and quiet front-end geniuses that you see make an appearance in various places online. His site has a &#8220;lab&#8221; section with some neat CSS3 demos and experiments that are worth poking around.</p>
<h2><a href="http://videojs.com/">Video.js</a></h2>
<p><a href="http://videojs.com/"><img src="http://cdn.impressivewebs.com/2012-05/videojs.jpg" alt="simurai's CSS lab" title="simurai's CSS lab" width="680" height="200" class="wide_image wi_new"></a><br />
A cool HTML video player that boasts &#8220;same HTML/CSS skin and JavaScript API for HTML5 and Flash Video&#8221; plus additional fullscreen and subtitle support. Definitely an option to consider for those looking for bulletproof HTML5 video.</p>
<h2><a href="http://cssrefresh.frebsite.nl/">CSSrefresh</a></h2>
<p><a href="http://cssrefresh.frebsite.nl/"><img src="http://cdn.impressivewebs.com/2012-05/css-refresh.jpg" alt="CSSrefresh" title="CSSrefresh" width="680" height="200" class="wide_image wi_new"></a><br />
&#8220;CSSrefresh is a small, unobstructive javascript file that monitors the CSS-files included in your webpage. As soon as you save a CSS-file, the changes are directly implemented, without having to refresh your browser.&#8221;</p>
<h2><a href="http://cssarrowplease.com/">CSS Arrow Please</a></h2>
<p><a href="http://cssarrowplease.com/"><img src="http://cdn.impressivewebs.com/2012-05/css-arrow.jpg" alt="CSS Arrow Please" title="CSS Arrow Please" width="680" height="200" class="wide_image wi_new"></a><br />
You probably know that arrows and other shapes can be created with pure CSS using pseudo-elements. Well, this is a simple app that lets you create a <a href="http://www.impressivewebs.com/pure-css-tool-tips/">CSS tooltip-like box</a> with an arrow. You can modify the color, size, and location of the &#8220;arrow&#8221; and see it change in real time along with the code that produces it.</p>
<h2><a href="http://csscience.com/responsiveslidercss3/">CSS3 Responsive Slider</a></h2>
<p><a href="http://csscience.com/responsiveslidercss3/"><img src="http://cdn.impressivewebs.com/2012-05/responsive-slider.jpg" alt="CSS3 Responsive Slider" title="CSS3 Responsive Slider" width="680" height="200" class="wide_image wi_new"></a><br />
This is a responsive, pure CSS3 image slider that uses a combination of <a href="http://css3clickchart.com/?prop=transitions">CSS3 transitions</a> and radio buttons to create functionality similar to that of a JavaScript-based slider.</p>
<h2>More Tools/Sources Welcome</h2>
<p>I don&#8217;t do these types of lists too often, but if you have any tools or resources that would be of interest to front-end developers, feel free to <a href="https://twitter.com/#!/ImpressiveWebs">tweet me</a>, <a href="http://www.impressivewebs.com/contact/">contact me</a> or post a comment here.</p>
 <img src="http://www.impressivewebs.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=6682" width="1" height="1" style="display: none;" /><p>Related posts:<ol>
<li><a href='http://www.impressivewebs.com/html5-resources/' rel='bookmark' title='Some HTML5 Resources Worth Checking Out'>Some HTML5 Resources Worth Checking Out</a></li>
<li><a href='http://www.impressivewebs.com/javascript-resources/' rel='bookmark' title='Some JavaScript Resources Worth Checking Out'>Some JavaScript Resources Worth Checking Out</a></li>
<li><a href='http://www.impressivewebs.com/html-slidedeck-toolkits/' rel='bookmark' title='Roundup of HTML-Based Slide Deck Toolkits'>Roundup of HTML-Based Slide Deck Toolkits</a></li>
</ol></p>
<p><a href="http://feedads.g.doubleclick.net/~a/VvHKKc6bqMSF_DDoJ3Foq0Hh8_M/0/da"><img src="http://feedads.g.doubleclick.net/~a/VvHKKc6bqMSF_DDoJ3Foq0Hh8_M/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/VvHKKc6bqMSF_DDoJ3Foq0Hh8_M/1/da"><img src="http://feedads.g.doubleclick.net/~a/VvHKKc6bqMSF_DDoJ3Foq0Hh8_M/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=y_mYbpv9__0:uag20jOlpHE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=y_mYbpv9__0:uag20jOlpHE:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?i=y_mYbpv9__0:uag20jOlpHE:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ImpressiveWebs/~4/y_mYbpv9__0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.impressivewebs.com/css-html-tools-resources/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Fixed Table of Contents Drop-Down Menu (jQuery Plugin)</title>
		<link>http://www.impressivewebs.com/fixed-table-of-contents-drop-down-menu-jquery-plugin/</link>
		<comments>http://www.impressivewebs.com/fixed-table-of-contents-drop-down-menu-jquery-plugin/#comments</comments>
		<pubDate>Mon, 07 May 2012 16:35:26 +0000</pubDate>
		<dc:creator>Louis Lazaris</dc:creator>
				<category><![CDATA[JavaScript & jQuery]]></category>
		<category><![CDATA[Web Design Tutorials]]></category>

		<guid isPermaLink="false">http://www.impressivewebs.com/?p=6648</guid>
		<description><![CDATA[<img src="http://cdn.impressivewebs.com/2012-05/fixed-toc-dropdown-menu.jpg" alt="Fixed Table of Contents Drop-Down Menu (jQuery Plugin)" title="Fixed Table of Contents Drop-Down Menu (jQuery Plugin)" width="184" height="184" class="article_image">About a week or so ago, I stumbled across the <cite>Startups, This Is How Design Works</cite> website. It's a one-page site that uses a fixed drop-down menu at the top of the screen that collapses/expands in a "table of contents" style.

I thought it was kinda cool, so I wrote my own script to create this functionality, and I turned it into a jQuery plugin. Use the button below to view the demo, and read on for a description.]]></description>
			<content:encoded><![CDATA[<p><img src="http://cdn.impressivewebs.com/2012-05/fixed-toc-dropdown-menu.jpg" alt="Fixed Table of Contents Drop-Down Menu (jQuery Plugin)" title="Fixed Table of Contents Drop-Down Menu (jQuery Plugin)" width="184" height="184" class="article_image">About a week or so ago, I stumbled across the <a href="http://startupsthisishowdesignworks.com/">Startups, This Is How Design Works</a> website. It&#8217;s a one-page site that uses a fixed drop-down menu at the top of the screen that collapses/expands in a &#8220;table of contents&#8221; style.</p>
<p>I thought it was kinda cool, so I wrote my own script to create this functionality, and I turned it into a jQuery plugin. Use the button below to view the demo, and read on for a description.</p>
<div class="button_holder">
<ul class="button">
<li><a href="http://www.impressivewebs.com/demo-files/fixed-TOC-dropdown-jquery/" title="View Demo">View Demo</a></li>
</ul>
</div>
<p>You can also view the <a href="http://www.impressivewebs.com/demo-files/fixed-TOC-dropdown-jquery-alternate/">alternate demo</a> that doesn&#8217;t use submenus.</p>
<p>The HTML is structured using unordered nested lists. I suppose I could have used ordered lists to facilitate maintainable numbering, but I thought it was fine this way and if someone wants to use ordered lists they can just alter the markup and make a small change in the script.</p>
<p>After you include the plugin in your page, here&#8217;s how you use it:</p>
<pre name="code" class="js">
// call the plugin on the "#toc" element
$('#toc').fixedTOC({
	menuOpens: 'click',
	scrollSpeed: 1000,
	menuSpeed: 300,
	useSubMenus: true,
	resetSubMenus: true,
	topLinkWorks: true
});
</pre>
<p>The default settings are shown above. You don&#8217;t actually have to include any of these, this is just so you can see the available customizable options. And here&#8217;s a description of what they do:</p>
<p><strong>menuOpens</strong><br />
The jQuery event that will open the menu. The two most logical options are <code>click</code> and <code>mouseenter</code>.</p>
<p><strong>scrollSpeed</strong><br />
Speed of the animated scrolling, in milliseconds.</p>
<p><strong>menuSpeed</strong><br />
Speed of the &#8220;dropping&#8221; menu and submenus, in milliseconds.</p>
<p><strong>useSubMenus</strong><br />
If your menu doesn&#8217;t have any nested lists, which means no &#8220;submenus&#8221;, then set this to <code>false</code>. This will cause the main menu links to become active. By default, the main menu links don&#8217;t scroll to anywhere, they just open the submenus.</p>
<p><strong>resetSubMenus</strong><br />
By default, each time you mouse off the menu, the menu collapses and any active submenu also collapses. If you want to keep the active submenu open, set this to <code>false</code>.</p>
<p><strong>topLinkWorks</strong><br />
Finally, if your page doesn&#8217;t include the &#8220;top&#8221; link (which appears on the demo in the bottom right area of the page, letting the user scroll back to the top), set this to <code>false</code>.</p>
<p>Each of the hyperlinks in the menu needs to correspond to an ID on the page for the in-page-scroll part to actually work. And my demo is also responsive and slightly changes the look of the menu and &#8220;top&#8221; link on a small screen (although I haven&#8217;t really done too much testing for this).</p>
<p>If you have any suggestions or feedback, comment below or open an issue on the <a href="https://github.com/impressivewebs/fixed-TOC-dropdown-jquery">GitHub repo</a>. I suppose it would be cool to expand the script to be able to parse the HTML and create the drop-down menu automatically <a href="http://projects.jga.me/toc/" rel="nofollow">like this script does</a>. Also, I haven&#8217;t done anything special in the CSS to deal with JavaScript-off users, but you could easily add a &#8220;no-js&#8221; class to the body and use that CSS hook to do some stuff when JavaScript is off, and remove the class when JavaScript is on (as Modernizr does).</p>
<div class="button_holder">
<ul class="button">
<li><a href="http://www.impressivewebs.com/demo-files/fixed-TOC-dropdown-jquery/" title="View Demo">View Demo</a></li>
</ul>
<ul class="button button_download">
<li><a href="https://github.com/impressivewebs/fixed-TOC-dropdown-jquery/zipball/master" title="Download Code">Download Code</a></li>
</ul>
</div>
 <img src="http://www.impressivewebs.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=6648" width="1" height="1" style="display: none;" /><p>Related posts:<ol>
<li><a href='http://www.impressivewebs.com/mega-menus-ajax-jquery/' rel='bookmark' title='Slide-Down Mega Drop-Down Menus with Ajax and jQuery'>Slide-Down Mega Drop-Down Menus with Ajax and jQuery</a></li>
<li><a href='http://www.impressivewebs.com/drop-down-menu-pet-peeve/' rel='bookmark' title='One Thing I Don&#8217;t Like About Drop-Down Menus'>One Thing I Don&#8217;t Like About Drop-Down Menus</a></li>
<li><a href='http://www.impressivewebs.com/linking-to-jquery/' rel='bookmark' title='Linking to jQuery: Always Reference a Specific Version'>Linking to jQuery: Always Reference a Specific Version</a></li>
</ol></p>
<p><a href="http://feedads.g.doubleclick.net/~a/zkE_AIffmFOtO7kDpibk4gP4qXw/0/da"><img src="http://feedads.g.doubleclick.net/~a/zkE_AIffmFOtO7kDpibk4gP4qXw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/zkE_AIffmFOtO7kDpibk4gP4qXw/1/da"><img src="http://feedads.g.doubleclick.net/~a/zkE_AIffmFOtO7kDpibk4gP4qXw/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=zGDM90ai3rg:FBZLGDWFPBQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=zGDM90ai3rg:FBZLGDWFPBQ:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?i=zGDM90ai3rg:FBZLGDWFPBQ:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ImpressiveWebs/~4/zGDM90ai3rg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.impressivewebs.com/fixed-table-of-contents-drop-down-menu-jquery-plugin/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>CSS: The Good Parts</title>
		<link>http://www.impressivewebs.com/css-the-good-parts/</link>
		<comments>http://www.impressivewebs.com/css-the-good-parts/#comments</comments>
		<pubDate>Wed, 02 May 2012 10:00:05 +0000</pubDate>
		<dc:creator>Louis Lazaris</dc:creator>
				<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Web Design Articles]]></category>

		<guid isPermaLink="false">http://www.impressivewebs.com/?p=6606</guid>
		<description><![CDATA[<img src="http://cdn.impressivewebs.com/2012-05/css-good-parts.jpg" alt="CSS: The Good Parts" title="CSS: The Good Parts" width="184" height="184" class="article_image">In March I wrote about some of my least favourite parts of CSS. Admittedly, that was a pretty negative post, and I've even slightly changed my opinion of a few of those things, thanks to the comments.

But I like CSS a lot. So as a follow-up, I thought it would only be fair to list some of the things in CSS that I think work very well and thus are valuable to know and use often.]]></description>
			<content:encoded><![CDATA[<p><img src="http://cdn.impressivewebs.com/2012-05/css-good-parts.jpg" alt="CSS: The Good Parts" title="CSS: The Good Parts" width="184" height="184" class="article_image">In March I wrote about some of <a href="http://www.impressivewebs.com/css-the-bad-parts/">my least favourite parts of CSS</a>. Admittedly, that was a pretty negative post, and I&#8217;ve even slightly changed my opinion of a few of those things, thanks to the comments.</p>
<p>But I like CSS a lot. So as a follow-up, I thought it would only be fair to list some of the things in CSS that I think work very well and thus are valuable to know and use often.</p>
<h2>Media Queries</h2>
<p>Whoever thought up this idea is a genius. Media Queries are at the heart of the responsive design movement and they make writing cross-browser CSS fun again. They let us focus on flexibility of design that isn&#8217;t device-specific, but instead allows us to adjust the look and size of the layout depending on the size of the screen.</p>
<p>Overall, a very good part of CSS.</p>
<h2>Classes</h2>
<p>Classes are fantastic. You could write your entire stylesheet using classes for 95% of your selectors (which you <a href="http://coding.smashingmagazine.com/2011/12/12/an-introduction-to-object-oriented-css-oocss/">should be doing</a>) and you would have an efficient, easy-to-maintain stylesheet.</p>
<p>Especially when you use multiple classes on a single element are classes super-useful, and when you combine that with chaining classes, they&#8217;re even more powerful.</p>
<h2>Min-/Max- Width/Height</h2>
<p>Even with all of IE&#8217;s annoying bugs, using properties like <code>min-width</code> and <code>max-height</code> has been a great gift to CSS. <code>max-width</code> is especially useful when you want to prevent your responsive designs from going super-wide on really large browser windows.</p>
<p>So take advantage of the good browser support for these four properties and use them to add the perfect amount of flexibility to your designs.</p>
<h2>Inline-Block</h2>
<p>Is it a div? Is it a piece of text? Is it a form element? Nobody knows! Well, okay, <a href="http://www.impressivewebs.com/inline-block/">we know</a>. But elements that are styled as <code>display: inline-block</code> have all the benefits of block elements (including full margin sizing and width/height support) but can flow with inline content and be subject to white space and the <a href="http://www.impressivewebs.com/css-vertical-align/">vertical-align</a> property.</p>
<p>This is a great feature of CSS to remember for doing neat things with inline elements.</p>
<h2>Relative and Absolute Positioning</h2>
<p>Although they should not be overused for fear of making a layout unmaintainable or inflexible, using and understanding relative and <a href="http://www.impressivewebs.com/absolute-position-css/">absolute positioning</a> in CSS is essential to improving your CSS skills.</p>
<p>So if you don&#8217;t yet use positioning tricks in your layouts, then you&#8217;re missing out on a very easy and more or less cross-browser way to get things looking good.</p>
<h2>Fixed Elements and Backgrounds</h2>
<p>I think it&#8217;s safe to say this one was popularized by the granddaddy of all CSS galleries, <a href="http://www.csszengarden.com/">css Zen Garden</a>. Two of my favourites on there include <a href="http://www.csszengarden.com/?cssfile=202/202.css">Retro Theater</a> (which scrolls credits like on a movie screen around fixed elements) and <a href="http://www.csszengarden.com/?cssfile=189/189.css">Mozart</a> (which uses <code>background-attachment: fixed</code> to fix the background in place while the page scrolls).</p>
<p>I definitely think fixed backgrounds are not used enough nowadays and can open up a lot of creative possibilities.</p>
<h2>Line Height</h2>
<p>What would we do without this one? The <code>line-height</code> property has great browser support and can even be used to center elements vertically. But best of all, it allows us to make pages readable and attractive. So use it abundantly along with other typographic CSS properties.</p>
<h2>Pseudo-Elements</h2>
<p>Do I even have to explain this one? Well, if you&#8217;ve been living under a rock or if you&#8217;re new to CSS then definitely check out <a href="http://css-tricks.com/pseudo-element-roundup/">this roundup</a>, <a href="http://nicolasgallagher.com/tag/pseudo-elements/">this archive</a>, and <a href="http://coding.smashingmagazine.com/2011/07/13/learning-to-use-the-before-and-after-pseudo-elements-in-css/">my introductory tutorial</a> on the subject.</p>
<h2>Transitions and Transforms</h2>
<p>Although not all in-use browsers support them, and you still need all the vendor prefixes, combining transitions with transforms is a very nice addition to CSS.</p>
<p>Not only does this combo relieve us of the need for bloated jQuery scripts and plugins, they also degrade nicely. Thus, if a browser doesn&#8217;t support them, the user will just see static elements and he&#8217;ll be <a href="http://24ways.org/2009/ignorance-is-bliss">none the wiser</a>.</p>
<h2>@font-face</h2>
<p>Web fonts are better now than they&#8217;ve ever been. Yes, the syntax for cross-browser web fonts is complicated and <a href="http://paulirish.com/2009/bulletproof-font-face-implementation-syntax/">has a long evolutionary history</a>. But with services like <a href="http://www.google.com/webfonts">Google Fonts</a> and <a href="http://www.fontsquirrel.com/fontface/generator">Font Squirrel&#8217;s generator</a>, web fonts have never been easier to use.</p>
<h2>Easy One-Line Comments</h2>
<p>In my &#8220;bad parts&#8221; post, one of the things I described was the fact that CSS <a href="http://creativeandcode.com/the-crappy-state-of-css-commenting/">doesn&#8217;t allow a double slash for comments</a> the way other languages do. Well, that doesn&#8217;t mean you can&#8217;t do easy single-line comments. You see, browsers will ignore any line or block of CSS that they don&#8217;t recognize, so you could easily comment out a line or a block by putting a double forward slash (or really any random characters) at the start of any line of CSS.</p>
<p>I wouldn&#8217;t allow such comments to go into production code, but it can certainly be handy to quickly add a character to a line (or even a selector) just for temporary testing purposes, rather than having to add &#8220;/*&#8221; and &#8220;*/&#8221; to every block you want to comment out.</p>
<h2>box-sizing: border-box</h2>
<p>The standard box model was one of the &#8220;bad parts&#8221; in the previous post, so it&#8217;s only natural that this one is a &#8220;good part&#8221; of CSS. And it is. Paul Irish <a href="http://paulirish.com/2012/box-sizing-border-box-ftw/">explains how good it is</a>, so I won&#8217;t go into the details here.</p>
<p>And best of all? IE8 supports it. So if you&#8217;ve dropped support for IE6/7, then you&#8217;re ready to use this and make recalculating widths and padding a thing of the past.</p>
<h2>Attribute Selectors</h2>
<p>Although these have bugs in <a href="http://reference.sitepoint.com/css/attributeselector#compatibilitysection">a lot of older browsers</a>, overall they&#8217;re pretty safe to use.</p>
<p>They can come in handy when targeting HTML that you have no access to (and thus can&#8217;t add a class or ID to) and you can even use them to target elements with <a href="http://ejohn.org/blog/html-5-data-attributes/">data attributes</a>, which are custom attributes that you create yourself.</p>
<h2>What Are Your Favourite Parts of CSS?</h2>
<p>This list doesn&#8217;t include a lot of <a href="http://css3clickchart.com/">new CSS3 features</a>; for many of those, the jury is still out on whether they will be useful and perform well. And poor browser support (specifically IE7/8), in my opinion, rules out many of them as being laballed &#8220;good parts&#8221; just yet.</p>
<p>But I&#8217;m sure you have your own personal favourite parts of CSS &#8212; so post a comment if there&#8217;s anything valuable you feel I&#8217;ve missed.</p>
 <img src="http://www.impressivewebs.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=6606" width="1" height="1" style="display: none;" /><p>Related posts:<ol>
<li><a href='http://www.impressivewebs.com/css-the-bad-parts/' rel='bookmark' title='CSS: The Bad Parts'>CSS: The Bad Parts</a></li>
<li><a href='http://www.impressivewebs.com/business-decision-puppy-cloned/' rel='bookmark' title='Every Time You Make a Good Business Decision, a Puppy Gets Cloned'>Every Time You Make a Good Business Decision, a Puppy Gets Cloned</a></li>
<li><a href='http://www.impressivewebs.com/html5-seo/' rel='bookmark' title='Is HTML5 Good for SEO?'>Is HTML5 Good for SEO?</a></li>
</ol></p>
<p><a href="http://feedads.g.doubleclick.net/~a/AFgopWykbTi1MxXF1OkM-jKSjIE/0/da"><img src="http://feedads.g.doubleclick.net/~a/AFgopWykbTi1MxXF1OkM-jKSjIE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/AFgopWykbTi1MxXF1OkM-jKSjIE/1/da"><img src="http://feedads.g.doubleclick.net/~a/AFgopWykbTi1MxXF1OkM-jKSjIE/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=9Yx5Hg61xnA:6_XUHo1RyRs:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=9Yx5Hg61xnA:6_XUHo1RyRs:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?i=9Yx5Hg61xnA:6_XUHo1RyRs:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ImpressiveWebs/~4/9Yx5Hg61xnA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.impressivewebs.com/css-the-good-parts/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Mimic ‘onmouseout’ with CSS3 Transitions</title>
		<link>http://www.impressivewebs.com/mimic-onmouseout-css3-transitions/</link>
		<comments>http://www.impressivewebs.com/mimic-onmouseout-css3-transitions/#comments</comments>
		<pubDate>Thu, 26 Apr 2012 10:00:05 +0000</pubDate>
		<dc:creator>Louis Lazaris</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design Tutorials]]></category>

		<guid isPermaLink="false">http://www.impressivewebs.com/?p=6587</guid>
		<description><![CDATA[<img src="http://cdn.impressivewebs.com/2012-04/mimic-mouseout.jpg" alt="Mimic 'onmouseout' with CSS3 Transitions" title="Mimic 'onmouseout' with CSS3 Transitions" width="184" height="184" class="article_image">Here's a crazy and ridiculous tip that probably has limited uses, but illustrates some quirky possibilities with CSS3 transitions. I've written something about this <a href="">before</a> and Chris Coyier explained the basic concept <a href="http://css-tricks.com/different-transitions-for-hover-on-hover-off/">on his site</a>.

But in this quick post I'll show you how to make an element have a "mouseout" or "mouseleave" transition with no "mouseover" or "mouseenter" transition.]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a crazy and ridiculous tip that probably has limited uses, but illustrates some quirky possibilities with CSS3 transitions. I&#8217;ve written something about this <a href="">before</a> and Chris Coyier explained the basic concept <a href="http://css-tricks.com/different-transitions-for-hover-on-hover-off/">on his site</a>.</p>
<p>But in this quick post I&#8217;ll show you how to make an element have a &#8220;mouseout&#8221; or &#8220;mouseleave&#8221; transition with no &#8220;mouseover&#8221; or &#8220;mouseenter&#8221; transition. Here&#8217;s the code:</p>
<pre name="code" class="css">
.mouseout {
	width: 300px;
	height: 300px;
	margin: 100px auto;
	background-color: #bada55;
	-webkit-transition: -webkit-transform 2s linear;
	-moz-transition: -moz-transform 2s linear;
	-ms-transition: -ms-transform 2s linear;
	-o-transition: -o-transform 2s linear;
	transition: transform 2s linear;
}

.mouseout:hover {
	cursor: pointer;
	-webkit-transition: -webkit-transform 0s linear;
	-moz-transition: -moz-transform 0s linear;
	-ms-transition: -ms-transform 0s linear;
	-o-transition: -o-transform 0s linear;
	transition: transform 0s linear;
	-webkit-transform: rotate(360deg);
	-moz-transform: rotate(360deg);
	-ms-transform: rotate(360deg);
	-o-transform: rotate(360deg);
	transform: rotate(360deg);
}
</pre>
<p>And here&#8217;s the demo page link:</p>
<div class="button_holder">
<ul class="button">
<li><a href="http://www.impressivewebs.com/demo-files/mimic-mouseout-transitions" title="View Demo">View Demo</a></li>
</ul>
</div>
<p>Notice what happens when you hover on and off. Hovering on seems to have no effect, but then hovering off causes the element to animate a rotation transform.</p>
<h2>How Does it Work?</h2>
<p>There&#8217;s nothing too tricky going on here. Firstly, we take advantage of the fact that you can have different transitions for hovering on, and hovering off. Second, we use a timing of <code>0s</code> to disguise the hover on.</p>
<p>You&#8217;ll notice on hover we&#8217;re rotating the box 360 degrees. This doesn&#8217;t change the box&#8217;s position at all, because 360 degrees means it comes back &#8216;full circle&#8217; to where it started. But because the transition is taking place over a time of zero seconds, that means it&#8217;s instantaneous. So it appears as if there is no transition taking place at all.</p>
<div class="update-box"><b>Update:</b> As pointed out by <a href="http://www.impressivewebs.com/mimic-onmouseout-css3-transitions/#comment-20618">Federico</a>, the transition lines of code that use &#8220;0s&#8221; could instead each be written as <code>transition: none</code>, which has the same effect.</div>
<p>Then, when you hover-off, the hover off transition on the element takes place, thus returning the box to its original state &#8212; even though it already is in its original state. The hover-off transition takes place over a duration of two seconds, thus making the transition visible and giving the false appearance of a mouseout even occurring without a mouseover event.</p>
<p>Interesting, but probably very limited in possibilities. I really can&#8217;t think of any other property that could give the appearance of no hover-on transition. Let me know if you can think of another way to do this with CSS alone.</p>
<div class="button_holder">
<ul class="button">
<li><a href="http://www.impressivewebs.com/demo-files/mimic-mouseout-transitions" title="View Demo">View Demo</a></li>
</ul>
</div>
 <img src="http://www.impressivewebs.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=6587" width="1" height="1" style="display: none;" /><p>Related posts:<ol>
<li><a href='http://www.impressivewebs.com/alternative-units-css3-rotate-transforms/' rel='bookmark' title='Alternative Units for CSS3 Rotation Transforms'>Alternative Units for CSS3 Rotation Transforms</a></li>
<li><a href='http://www.impressivewebs.com/css3-transitions-without-hover/' rel='bookmark' title='CSS3 Transitions Without Using :hover'>CSS3 Transitions Without Using :hover</a></li>
<li><a href='http://www.impressivewebs.com/subtleties-css3-transitions/' rel='bookmark' title='The Subtleties of CSS3 Transitions'>The Subtleties of CSS3 Transitions</a></li>
</ol></p>
<p><a href="http://feedads.g.doubleclick.net/~a/k-0AHdnXrpduYUojahT_cW1J8fc/0/da"><img src="http://feedads.g.doubleclick.net/~a/k-0AHdnXrpduYUojahT_cW1J8fc/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/k-0AHdnXrpduYUojahT_cW1J8fc/1/da"><img src="http://feedads.g.doubleclick.net/~a/k-0AHdnXrpduYUojahT_cW1J8fc/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=5zLjHyMMyMY:EJtF81CqKOE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=5zLjHyMMyMY:EJtF81CqKOE:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?i=5zLjHyMMyMY:EJtF81CqKOE:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ImpressiveWebs/~4/5zLjHyMMyMY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.impressivewebs.com/mimic-onmouseout-css3-transitions/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Some Useful Docs and Guides for Front-End Developers</title>
		<link>http://www.impressivewebs.com/docs-guides-front-end-developers/</link>
		<comments>http://www.impressivewebs.com/docs-guides-front-end-developers/#comments</comments>
		<pubDate>Wed, 25 Apr 2012 10:00:42 +0000</pubDate>
		<dc:creator>Louis Lazaris</dc:creator>
				<category><![CDATA[Roundups & Resources]]></category>

		<guid isPermaLink="false">http://www.impressivewebs.com/?p=6561</guid>
		<description><![CDATA[<img src="http://cdn.impressivewebs.com/2012-04/docs-guides-frontend.jpg" alt="Some Useful Docs and Guides for Front-End Developers" title="Some Useful Docs and Guides for Front-End Developers" width="184" height="184" class="article_image">My "saved for later" link lists are getting bigger, so I thought I'd post another one of these little roundups. This time, I'm mostly focusing on some interesting guides and docs that I've found recently. 

As always, I can't necessarily vouch for the quality and accurateness of all of these sources, but they are all certainly worth a glance. Enjoy.]]></description>
			<content:encoded><![CDATA[<p>My &#8220;saved for later&#8221; link lists are getting bigger, so I thought I&#8217;d post another one of these little roundups. This time, I&#8217;m mostly focusing on some interesting guides and docs that I&#8217;ve found recently.</p>
<p>As always, I can&#8217;t necessarily vouch for the quality and accurateness of all of these sources, but they are all certainly worth a glance. Enjoy.</p>
<h2><a href="http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml">Google JavaScript Style Guide</a></h2>
<p><a href="http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml"><img src="http://cdn.impressivewebs.com/2012-04/google-js-style-guide.jpg" alt="Google JavaScript Style Guide" title="Google JavaScript Style Guide" width="680" height="282" class="wide_image wi_new"></a><br />
This is a somewhat obscure resource, and I haven&#8217;t delved into it much, but looks like it could contain some interesting nuggets. This is basically Google&#8217;s style guide for writing JavaScript. It&#8217;s divided into two main sections: Language Rules and Style Rules. They sum it up nicely: &#8220;The point of having style guidelines is to have a common vocabulary of coding so people can concentrate on what you&#8217;re saying rather than on how you&#8217;re saying it.&#8221;</p>
<h2><a href="http://www.starbucks.com/static/reference/styleguide/">Starbucks&#8217; Style Guide</a></h2>
<p><img src="http://cdn.impressivewebs.com/2012-04/starbucks-style-guide.jpg" alt="Starbucks' Style Guide" title="Starbucks' Style Guide" width="680" height="282" class="wide_image wi_new"><br />
This one made the rounds a few weeks back thanks to <a href="https://twitter.com/#!/stubbornella/status/182313143190560768">a tweet by Nicole Sullivan</a>. More and more large sites and apps are adapting responsive, flexible, CSS that uses OOCSS principles, and this is a good example. The guide has some options in the top-right corner of the screen that let you toggle stuff you want highlighted or visible while you check out various features of the guide.</p>
<h2><a href="https://github.com/rmurphey/js-assessment/">A Test-Driven JS Assessment</a></h2>
<p><a href="https://github.com/rmurphey/js-assessment/"><img src="http://cdn.impressivewebs.com/2012-04/js-assessment.jpg" alt="js-assessment" title="js-assessment" width="680" height="282" class="wide_image wi_new"></a><br />
This is an interesting little project by <a href="http://rmurphey.com/">Rebecca Murphey</a>. It&#8217;s a GitHub repo that consists of &#8220;a set of tests that can be used to assess the skills of a candidate for a JavaScript position, or to improve one&#8217;s own skills.&#8221; There are instructions on how to install and run the tests locally. Definitely something for front-end developers who want to take their JavaScript to the next level.</p>
<h2><a href="http://rmurphey.com/blog/2012/04/12/a-baseline-for-front-end-developers/">A Baseline for Front-End Developers</a></h2>
<p><a href="http://rmurphey.com/blog/2012/04/12/a-baseline-for-front-end-developers/"><img src="http://cdn.impressivewebs.com/2012-04/baseline-front-end.jpg" alt="A Baseline for Front-End Developers" title="A Baseline for Front-End Developers" width="680" height="282" class="wide_image wi_new"></a><br />
More awesomeness from Rebecca. In her own words: &#8220;There&#8217;s a new set of baseline skills required in order to be successful as a front-end developer, and developers who don&#8217;t meet this baseline are going to start feeling more and more left behind as those who are sharing their knowledge start to assume that certain things go without saying.&#8221; Although not everyone agrees with her assessment of the front-end baseline, I think this is a must-read for all front-end developers. You can also check out <a href="http://speakerdeck.com/u/rmurphey/p/a-new-baseline-for-front-end-devs">this slide deck</a> that covers the same subject.</p>
<h2><a href="http://html5please.us/">HTML5 Please</a></h2>
<p><a href="http://html5please.us/"><img src="http://cdn.impressivewebs.com/2012-04/html5-please.jpg" alt="HTML5 Please" title="HTML5 Please" width="680" height="282" class="wide_image wi_new"></a><br />
Although this one definitely needs a new name (most of what it covers is not &#8220;HTML5&#8243;), this is a great resource for dealing with the realities of web development today. That is, the fact that there are multiple worlds of support because of older versions of IE still in use, and the fact that even modern browsers don&#8217;t have consistent support. In a nutshell, this projects helps you &#8220;use the new and shiny responsibly.&#8221;</p>
<h2><a href="http://killdream.github.com/blog/2011/10/understanding-javascript-oop/">Understanding JavaScript OOP</a></h2>
<p><a href="http://killdream.github.com/blog/2011/10/understanding-javascript-oop/"><img src="http://cdn.impressivewebs.com/2012-04/js-oop.jpg" alt="Understanding JavaScript OOP" title="Understanding JavaScript OOP" width="680" height="282" class="wide_image wi_new"></a><br />
This looks like a really good in-depth little mini-book on OOP principles and how they&#8217;re used in JavaScript. It&#8217;s written by a Brazil-based front-end developer by the name of Quildreen Motta. The coolness of his name alone makes this one worth reading! :)</p>
<h2><a href="http://www.longtailvideo.com/html5/">The State Of HTML5 Video</a></h2>
<p><a href="http://www.longtailvideo.com/html5/"><img src="http://cdn.impressivewebs.com/2012-04/state-html5-video.jpg" alt="The State Of HTML5 Video" title="The State Of HTML5 Video" width="680" height="282" class="wide_image wi_new"></a><br />
This is a regularly-maintained page on the <a href="http://www.longtailvideo.com/">LongTail Video</a> site. It summarizes browser support in chart format for a number of different HTML5 video-related features including media formats, the API, accessibility, and more. Pretty comprehensive stuff that&#8217;s comparable to what <a href="http://wufoo.com/html5/">Wufoo did with HTML5 forms</a>.</p>
 <img src="http://www.impressivewebs.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=6561" width="1" height="1" style="display: none;" /><p>Related posts:<ol>
<li><a href='http://www.impressivewebs.com/skills-front-end-developers/' rel='bookmark' title='Skills for Front-End Developers'>Skills for Front-End Developers</a></li>
<li><a href='http://www.impressivewebs.com/study-html5-design-principles/' rel='bookmark' title='Why Developers Should Be Studying HTML5&#8242;s Design Principles'>Why Developers Should Be Studying HTML5&#8242;s Design Principles</a></li>
<li><a href='http://www.impressivewebs.com/video-for-everybody/' rel='bookmark' title='Video For Everybody &#8212; Except Developers!'>Video For Everybody &#8212; Except Developers!</a></li>
</ol></p>
<p><a href="http://feedads.g.doubleclick.net/~a/08dBonJTTHtWi9_9-CK_c5qndyQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/08dBonJTTHtWi9_9-CK_c5qndyQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/08dBonJTTHtWi9_9-CK_c5qndyQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/08dBonJTTHtWi9_9-CK_c5qndyQ/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=PBwucUWbio4:d1pz20PmF9g:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=PBwucUWbio4:d1pz20PmF9g:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?i=PBwucUWbio4:d1pz20PmF9g:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ImpressiveWebs/~4/PBwucUWbio4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.impressivewebs.com/docs-guides-front-end-developers/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CSS3 Structural Pseudo-class Expressions Explained</title>
		<link>http://www.impressivewebs.com/css3-pseudo-class-expressions/</link>
		<comments>http://www.impressivewebs.com/css3-pseudo-class-expressions/#comments</comments>
		<pubDate>Tue, 24 Apr 2012 17:14:26 +0000</pubDate>
		<dc:creator>Louis Lazaris</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Design Tutorials]]></category>

		<guid isPermaLink="false">http://www.impressivewebs.com/?p=6528</guid>
		<description><![CDATA[<img src="http://cdn.impressivewebs.com/2012-04/pseudo-expressions.jpg" alt="CSS Structural Pseudo-class Expressions Explained" title="CSS Structural Pseudo-class Expressions Explained" width="184" height="184" class="article_image">You probably know that the CSS3 spec includes a number of structural pseudo-classes. Four of these pseudo-classes use function-like syntax that allow an argument to be passed in using parentheses. These are: nth-child(), nth-last-child(), nth-of-type(), and nth-last-of-type().

The purpose of the parentheses is to allow one or more elements to be selected based on a keyword (either <code>odd</code> or <code>even</code>), an integer, or an expression.]]></description>
			<content:encoded><![CDATA[<p>You probably know that the CSS3 spec includes a number of <a href="http://www.w3.org/TR/selectors/#structural-pseudos">structural pseudo-classes</a>. Four of these pseudo-classes use function-like syntax that allow an argument to be passed in using parentheses. These are:</p>
<ul class="body_list">
<li><a href="http://www.w3.org/TR/selectors/#nth-child-pseudo">nth-child()</a></li>
<li><a href="http://www.w3.org/TR/selectors/#nth-last-child-pseudo">nth-last-child()</a></li>
<li><a href="http://www.w3.org/TR/selectors/#nth-of-type-pseudo">nth-of-type()</a></li>
<li><a href="http://www.w3.org/TR/selectors/#nth-last-of-type-pseudo">nth-last-of-type()</a></li>
</ul>
<p>The purpose of the parentheses is to allow one or more elements to be selected based on a keyword (either <code>odd</code> or <code>even</code>), an integer, or an expression.</p>
<p>The keywords and the integer are pretty straightforward. A value of &#8220;even&#8221; or &#8220;odd&#8221; selects the even or odd elements, respectively, and an integer selects the <i>n</i>th of the targeted element. In other words, &#8220;li:nth-child(4)&#8221; means the &#8220;4th&#8221; list item will be selected.</p>
<p>The expressions, on the other hand, are a little more complicated, but not too bad once you mess around with them a little.</p>
<h2>Expression Syntax</h2>
<p>The basic syntax for a pseudo-class expression looks like this:</p>
<pre name="code" class="css">
li:nth-child(an+b) {
	/* styles here */
}
</pre>
<p>Except for the &#8220;n&#8221;, the above is not valid, but serves to illustrate the expression in algebraic-like notation. In that expression, each of the letters &#8220;a&#8221; and &#8220;b&#8221; would be integers. Here&#8217;s what these letters represent:</p>
<p><strong>What is the &#8220;b&#8221; part?</strong><br />
The &#8220;b&#8221; part of the expression is an integer that tells the browser what is the first of that type of element to select. Thus if the &#8220;b&#8221; part is &#8220;4&#8243; then the &#8220;4th&#8221; element will be selected first, and all preceding elements are ignored.</p>
<p><strong>What is the &#8220;a&#8221; part?</strong><br />
The &#8220;a&#8221; part of the expression is an integer that tells the browser which of those types of elements to select <i>after</i> the first one has been selected. So if &#8220;a&#8221; is represented by the integer &#8220;3&#8243;, and &#8220;b&#8221; is still &#8220;4&#8243;, then that means the 4th of that type of element will be selected first, and then every 3rd instance of the element will be selected afterwards, until no more can be found.</p>
<p><strong>What is the &#8220;n&#8221; part?</strong><br />
As alluded to above, the &#8220;n&#8221; part doesn&#8217;t get changed when you write your expression. The &#8220;n&#8221; is an indicator to the browser to identify the &#8220;a&#8221; part. This will make more sense in the real examples below.</p>
<h2>Some Real Examples</h2>
<p>Below are some legitimate examples using different pseudo-classes. Each example is followed by an explanation of what that example does. Keep in mind that, for all of these structural pseudo-classes, the elements selected are siblings. That is, they are children of the same parent element. This means the expression begins counting anew for each parent that contains the selected elements.</p>
<p><strong>Expression: 4n+2</strong></p>
<pre name="code" class="css">
li:nth-child(4n+2) {
	background: hotpink;
}
</pre>
<p>&uarr; Selects the 2nd list item, and every 4th list item after that.</p>
<p><strong>Expression: 5n-1</strong></p>
<pre name="code" class="css">
li:nth-child(5n-1) {
	background: hotpink;
}
</pre>
<p>&uarr; Selects the -1st list item, and every 5th list item after that. Because the first-selected element is a negative number (-1), you have to imagine a sort of &#8220;ghost&#8221; element appearing before the real list of elements, and you would also have to include a zero-level element that gets counted when every &#8220;5th&#8221; element begins to be counted.</p>
<p><strong>Expression: -2n+7</strong></p>
<pre name="code" class="css">
li:nth-child(-2n+7) {
	background: hotpink;
}
</pre>
<p>&uarr; In this example, the &#8220;b&#8221; part is given a negative integer. This will select the 7th list item and then every -2nd list item after that. This means that no list items will be selected after the 7th one. But instead, after selecting the 7th one, the count will reverse and go back up the list, selecting every 2nd element.</p>
<p><strong>Expression: 4n+7</strong></p>
<pre name="code" class="css">
li:nth-last-child(4n+7) {
	background: hotpink;
}
</pre>
<p>&uarr; This one uses the &#8220;nth-last-child&#8221; pseudo-class, which means the expression starts at the bottom of the list. This will select the 7th-last list item (i.e. 7th from the bottom of the list) and every 4th-last list item after that.</p>
<p><strong>Expression: 3n-2</strong></p>
<pre name="code" class="css">
li:nth-last-child(3n-2) {
	background: hotpink;
}
</pre>
<p>&uarr; Again, we&#8217;re using &#8220;nth-last-child&#8221;, but this time we&#8217;re combining it with a negative integer. This example selects the -2nd-last list item (meaning you have to imagine a &#8220;ghost&#8221; zero item along with 2 other &#8220;ghost&#8221; elements) and every 3rd-last list item.</p>
<p><strong>Expression: 5n+3</strong></p>
<pre name="code" class="css">
p:nth-of-type(5n+3) {
	background: hotpink;
}
</pre>
<p>&uarr; This example uses the &#8220;nth-of-type&#8221; pseudo-class. This means only the referenced element will be included in the expression. In this case, we&#8217;re targeting paragraph elements. So this will select the third paragraph element then every 5th paragraph after that.</p>
<p><strong>Expression: 2n+8</strong></p>
<pre name="code" class="css">
div:nth-last-of-type(2n+8) {
	background: hotpink;
}
</pre>
<p>&uarr; This example uses &#8220;nth-last-of-type&#8221;, which selects the last element of that type of element. In this case, we&#8217;re targeting <code>&lt;div&gt;</code> elements. So all other elements will be ignored, even if they are in between. This will select the 8th-last <code>&lt;div&gt;</code> element, and every 2nd last <code>&lt;div&gt;</code> element after that.</p>
<h2>Browser Support and Other Notes</h2>
<p>Here are some things worth mentioning about these expressions:</p>
<ul class="body_list">
<li>Browser support is very good; the only significant lack of support is (and you&#8217;ll be shocked to hear this) IE6-8.</li>
<li>There are older browsers like Firefox 3.0, Safari 3.1 and Opera 9 that don&#8217;t support these but their market shares are so low that for most people this wouldn&#8217;t be a factor</li>
<li>You can polyfill support for these using <a href="http://selectivizr.com/">Selectivizr</a> but <a href="http://html5please.com/#selectors">read this</a> before you do</li>
<li>If you use the same integer for &#8220;a&#8221; and &#8220;b&#8221;, then you can omit the &#8220;b&#8221; part in the expression; in other words, <code>3n+3</code> would have the same result as <code>3n</code></li>
<li>If you use &#8220;1&#8243; for the &#8220;a&#8221; part, you can omit it but leave the &#8220;n&#8221;; in other words, <code>1n+5</code> is the same as <code>n+5</code></li>
<li>If you use a zero for the &#8220;a&#8221; part, you can omit the &#8220;a&#8221; part altogether; in other words, <code>0n+3</code> is the same as <code>3</code></li>
</ul>
<p>(Thanks to <a href="https://twitter.com/#!/thebabydino">Ana</a> in the comments for helping me undiscombobulate the logic in a few of those bullet points)</p>
 <img src="http://www.impressivewebs.com/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=6528" width="1" height="1" style="display: none;" /><p>Related posts:<ol>
<li><a href='http://www.impressivewebs.com/css-white-space/' rel='bookmark' title='The CSS white-space Property Explained'>The CSS white-space Property Explained</a></li>
<li><a href='http://www.impressivewebs.com/inherit-value-css/' rel='bookmark' title='The &#8220;inherit&#8221; Value for CSS Properties'>The &#8220;inherit&#8221; Value for CSS Properties</a></li>
</ol></p>
<p><a href="http://feedads.g.doubleclick.net/~a/-22_pkA7f3UpOdP7ZDE15odJufQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/-22_pkA7f3UpOdP7ZDE15odJufQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/-22_pkA7f3UpOdP7ZDE15odJufQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/-22_pkA7f3UpOdP7ZDE15odJufQ/1/di" border="0" ismap="true"></img></a></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=fq-dlTXJgzA:u8pQ0provLI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ImpressiveWebs?a=fq-dlTXJgzA:u8pQ0provLI:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ImpressiveWebs?i=fq-dlTXJgzA:u8pQ0provLI:D7DqB2pKExk" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ImpressiveWebs/~4/fq-dlTXJgzA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.impressivewebs.com/css3-pseudo-class-expressions/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss><!-- Dynamic page generated in 0.483 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-05-16 13:22:23 -->

