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

<channel>
	<title>nooshu &#187; CSS Archives </title>
	<atom:link href="http://nooshu.com/category/css/feed" rel="self" type="application/rss+xml" />
	<link>http://nooshu.com</link>
	<description>Kneeling on the shoulders of giants</description>
	<lastBuildDate>Fri, 20 Jan 2012 11:38:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Writing efficient CSS selectors</title>
		<link>http://nooshu.com/writing-efficient-css-selectors?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=writing-efficient-css-selectors</link>
		<comments>http://nooshu.com/writing-efficient-css-selectors#comments</comments>
		<pubDate>Thu, 08 Dec 2011 06:43:59 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Interesting]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[selector]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=2045</guid>
		<description><![CDATA[With browsers getting faster all the time it's a good idea to remember that not everyone uses them. Writing efficient code is key to maximising device accessibility.]]></description>
			<content:encoded><![CDATA[<p>With modern browsers getting quicker with every new version number it&#8217;s easy to fall into the trap of writing inefficient code. A page will run super quick on the latest version on Chrome or Firefox, but you also have to consider older browsers and mobile devices. That shiny new web application that uses some super fancy CSS selectors may be unusable on certain devices due to its limited hardware. That&#8217;s not to say you shouldn&#8217;t be using super fancy selectors; you just have to be careful to consider your target audience, and use them in the most efficient way possible.</p>
<p>The first thing to note about CSS selectors is they don&#8217;t work in the way you&#8217;d expect. In the west we read a page from left to right. Reading a CSS selector, you&#8217;d expect that&#8217;s what the browser does as well. Wrong! The browser actually reads a selector from right to left (in Mozilla&#8217;s case anyway, and most likely in others too). So take the following CSS as an example:</p>
<div class="codecolorer-container css default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">body <span style="color: #cc00cc;">#wrapper</span> <span style="color: #6666ff;">.article</span> ul<span style="color: #6666ff;">.meta</span> li a <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">700</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Arial<span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>The browser first looks for all the anchor tags (called the &#8220;key&#8221; as it&#8217;s the rightmost selector), then looks at the list items, it evaluates those and throws away the results that don&#8217;t match. Next the browser moves onto elements with a class of &#8220;meta&#8221;, throwing out results that don&#8217;t match and so on&#8230; you get the idea! There&#8217;s so much redundancy in the above selector, it could easily be cut down to:</p>
<div class="codecolorer-container css default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6666ff;">.meta</span> a <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">700</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">text-decoration</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-family</span><span style="color: #00AA00;">:</span> Arial<span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>This example is much more efficient. There are less rules for the browser to evaluate, it&#8217;s much easier to read and if you apply minimal selectors across your whole stylesheet you will notice a big difference in file size. The key to writing efficient selectors is to be as specific as possible. Whatever you do don&#8217;t write this:</p>
<div class="codecolorer-container css default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">body <span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>The universal selector(*) is bad (even body isn&#8217;t needed)! You are targeting every single element in the DOM and setting it&#8217;s padding and margin to zero. For a large page that could easily be thousands of elements!</p>
<p>I actually inspected the stylesheet for this website and went over it with a fine tooth comb. I found many additional selectors that just weren&#8217;t needed. The size of my stylesheet went from 18.3kB down to 16.5kB, a saving of 1.8kB. It doesn&#8217;t sound a lot in terms of file size, but that&#8217;s a whole lot of selectors the browser no longer has to evaluate to render the page.</p>
<p>Luckily there are tools available that can help you make your CSS more efficient, as well as many other areas of your website too. The first tool I&#8217;d recommend is called <a href="http://code.google.com/speed/page-speed/docs/overview.html">Page Speed</a>, created by Google. The Page Speed extension is available on both Chrome and Firefox. Once installed you have the option to run it on any page; it will give you an overall score for that page and recommendations on how to <a href="http://code.google.com/speed/page-speed/docs/rules_intro.html">improve it</a>.</p>
<div id="attachment_2047" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2011/12/google-page-speed.jpg"><img src="http://nooshu.com/wp-content/uploads/2011/12/google-page-speed-518x279.jpg" alt="Google Page Speed results for Nooshu.com." title="google-page-speed" width="518" height="279" class="size-medium wp-image-2047" /></a><p class="wp-caption-text">Page Speed results for this site. Note the &quot;Use efficient CSS selectors&quot; drop down.</p></div>
<p>The second tool I&#8217;d recommend is Opera&#8217;s <a href="http://www.opera.com/dragonfly/">Dragonfly</a>. Dragonfly (similar to Firebug, in name at least) is Opera&#8217;s developer toolkit, much like Web Inspector for Chrome. An awesome feature that Dragonfly has, that other toolkits don&#8217;t is &#8220;style recalculation&#8221;. <a href="http://my.opera.com/dragonfly/blog/style-profiler-preview">Style recalculation</a> gives you a breakdown of all the selectors that were run on the page, how long they took to evaluate and how many elements they hit along the way (hits).</p>
<div id="attachment_2048" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2011/12/dragonfly-debugger.jpg"><img src="http://nooshu.com/wp-content/uploads/2011/12/dragonfly-debugger-518x279.jpg" alt="Opera&#039;s Dragonfly debugger in action on nooshu.com." title="dragonfly-debugger" width="518" height="279" class="size-medium wp-image-2048" /></a><p class="wp-caption-text">Dragonfly gives you an extremely useful breakdown of what selectors were used and how long they took to evaluate.</p></div>
<p>If you look closely at the results in the image above, you will see that the selectors with the most number of hits are the ones involving the universal selector(*), as you would expect. You may also notice that most of the timings say 0.0ms which isn&#8217;t very helpful. This is due to the fact that the size of the DOM being tested is very small, and timing to 1 decimal place isn&#8217;t accurate enough to show the actual time it took to evaluate. If you were to run this test on a huge page, say the <a href="http://dev.w3.org/html5/spec/Overview.html">HTML5 Specification</a> for example, you would really be able see the difference in CSS selector efficiency.</p>
<p>This feature of Dragonfly is very new and is still in testing. There are a few issues still to be ironed out in future releases but it&#8217;s definitely a tool to keep in your bookmarks.</p>
<p>A word of warning when it comes to writing efficient selectors. I found myself trying to make the selectors so efficient it was becoming quite hard to pin-point where exactly on the site they were being used. If you have a very specific area of a site you are trying to target, it is easier to read if you have the selectors starting with an ID reflecting that area. You then know for certain that the changes you make won&#8217;t affect other parts of the site. Also remember that removing &#8220;unused&#8221; selectors will affect the specificity of the rule. You could end up breaking something, as what you thought was an unused selector was actually used in overriding another rule.</p>
<p>Having too many descendent selectors is something that Page Speed frowns upon, but as with all things in life it&#8217;s a case of finding that happy medium. In this case it&#8217;s between efficient selectors and CSS that is easy to read and maintain (for you and other developers).</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/writing-efficient-css-selectors/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nooshu.com now with added HTML5 goodness</title>
		<link>http://nooshu.com/nooshu-com-now-with-added-html5-goodness?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nooshu-com-now-with-added-html5-goodness</link>
		<comments>http://nooshu.com/nooshu-com-now-with-added-html5-goodness#comments</comments>
		<pubDate>Sat, 17 Jul 2010 14:05:50 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[semantics]]></category>
		<category><![CDATA[site]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1279</guid>
		<description><![CDATA[Finally got round to HTML5ing my Wordpress theme. Lots to learn with the (ongoing) HTML5 specifications.]]></description>
			<content:encoded><![CDATA[<p>So I finally pulled my finger out and took the HTML5 plunge over the past day or so; the Nooshu WordPress theme now has a sprinkling of HTML5. Mmmm I have that warm fuzzy feeling of completeness! In all honesty it&#8217;s been an easy way to learn about the new <a href="http://dev.w3.org/html5/spec/Overview.html">HTML5 specifications</a> (although they aren&#8217;t complete and won&#8217;t become a W3C recommendation until 2022&#8230; no that isn&#8217;t a typo!).</p>
<p>HTML5 has added a host of new tags which have much more semantic meaning. So instead of using &#8216;divs&#8217; to section off areas of your page layout, you can now use:</p>
<div class="codecolorer-container html4strict default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">&lt;!-- Some of the new HTML5 Tags --&gt;</span><br />
<span style="color: #009900;">&lt;header&gt;&lt;<span style="color: #66cc66;">/</span>header&gt;</span><br />
<span style="color: #009900;">&lt;footer&gt;&lt;<span style="color: #66cc66;">/</span>footer&gt;</span><br />
<span style="color: #009900;">&lt;article&gt;&lt;<span style="color: #66cc66;">/</span>article&gt;</span><br />
<span style="color: #009900;">&lt;section&gt;&lt;<span style="color: #66cc66;">/</span>section&gt;</span><br />
<span style="color: #009900;">&lt;nav&gt;&lt;<span style="color: #66cc66;">/</span>nav&gt;</span></div></td></tr></tbody></table></div>
<p>It&#8217;s certainly a welcome addition to the modern web. My favourite part of HTML5 has to be the doctype (other than the canvas element):</p>
<div class="codecolorer-container html4strict default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">&lt;!-- No more --&gt;</span><br />
<span style="color: #00bbdd;">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01//EN&quot; &quot;http://www.w3.org/TR/html4/strict.dtd&quot;&gt;</span><br />
<br />
<span style="color: #808080; font-style: italic;">&lt;!-- Much better! --&gt;</span><br />
<span style="color: #00bbdd;">&lt;!DOCTYPE html&gt;</span></div></td></tr></tbody></table></div>
<p>Look how simple it is! No more copy / paste from a previous project for this doctype.</p>
<p>My main concern when converting the theme to HTML5 was how it would work in IE; as IE8 supports parts of HTML5 but IE6 and IE7 not at all. When IE comes across a tag it doesn&#8217;t recognise it just ignores it. Since the tags aren&#8217;t recognised you won&#8217;t be able to style your lovely new HTML5 template in IE6 &#038; IE7. Lucky you can patch this missing functionality using JavaScript. Remy Sharp has created a script called <a href="http://remysharp.com/2009/01/07/html5-enabling-script/">html5shim</a>, that adds the missing tags to IE. Just add the following code to your header and you will now be able to style your HTML5 tags:</p>
<div class="codecolorer-container html4strict default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">&lt;!--[if lt IE 9]&gt;</span><br />
<span style="color: #808080; font-style: italic;">&nbsp; &nbsp; &lt;script src=&quot;http://html5shim.googlecode.com/svn/trunk/html5.js&quot;&gt;&lt;/script&gt;</span><br />
<span style="color: #808080; font-style: italic;">&lt;![endif]--&gt;</span></div></td></tr></tbody></table></div>
<p>The script must be in the header and must fire before the DOM is created. The script simply creates all the new HTML5 elements using the document method &#8216;createElement&#8217;, you don&#8217;t even need to attach the created elements to the DOM! Now IE will recognise the tags and you can get on with your page styling. Yay!</p>
<p>Those who use WordPress 3.0 may have noticed that the default Kubric theme is no more and it&#8217;s been replaced with a new theme called twenty ten. The theme uses the HTML5 doctype but it doesn&#8217;t use any of the new tags. I guess because of the IE issues. Maybe this will be changed in future releases.</p>
<p>The Nooshu theme is still a work in progress, and I&#8217;ll modify areas as I learn more about the new HTML5 features. Here are a selection of links that I found incredibly useful while working on the theme:</p>
<ul>
<li><strong><a href="http://diveintohtml5.org/">Dive into HTML5</a></strong>: Read through this article and you will be well on your way to learning HTML5. It delves into the history of HTML and progresses forward right up to implementing the new specifications.</li>
<li><strong><a href="http://html5doctor.com/">HTML5 Doctor</a></strong>: Looking for HTML5 related news or need some clarification of a new tag? Look no further than HTML5 Doctor. Lots of articles available for you to read and there&#8217;s even the option to ask a question if you don&#8217;t find the answers you are looking for.</li>
<li><strong><a href="http://gsnedders.html5.org/outliner/">HTML 5 Outliner</a></strong>: So you&#8217;ve created your shiny new HTML5 template; why not check it with the outliner to see if it makes sense to a user / search engine.</li>
<li><strong><a href="http://validator.w3.org/">W3C Markup Validator</a></strong>: It&#8217;s been a while since I&#8217;ve used a validator since I have one <a href="https://addons.mozilla.org/firefox/addon/249">built into Firefox</a>, but the W3C validator was very handy for pointing out attributes and tags that are no longer supported in the specifications. It also gives you a quick benchmark to aim at.</li>
</ul>
<p>If you have any other useful HTML5 tips and links let me know below.</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/nooshu-com-now-with-added-html5-goodness/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aptana on Steroids using Zen Coding</title>
		<link>http://nooshu.com/aptana-on-steroids-using-zen-coding?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=aptana-on-steroids-using-zen-coding</link>
		<comments>http://nooshu.com/aptana-on-steroids-using-zen-coding#comments</comments>
		<pubDate>Tue, 04 May 2010 18:11:58 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[aptana]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[front-end]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1095</guid>
		<description><![CDATA[Zen Coding really is an incredibly simple idea, use CSS selectors to write HTML. It sounds like a chicken egg argument, but it really works. ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve mentioned before in previous articles that <a href="http://www.aptana.org/">Aptana</a> is my IDE of choice; one which I&#8217;ve been using for a few years. I only use a handful of the many features available in Aptana, all of which are also available in other editors (<a href="http://notepad-plus.sourceforge.net/uk/site.htm">Notepad++</a> being one), but I&#8217;ve got so used to the way it works I&#8217;m sticking with it for the moment.</p>
<p>One of Aptana&#8217;s helpful features is the ability to generate code using the easy to access menu bar at the top of the code window (see image):</p>
<div id="attachment_1098" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2010/05/aptana-code-feature.gif"><img src="http://nooshu.com/wp-content/uploads/2010/05/aptana-code-feature-518x112.gif" alt="Aptana has a host of code helpers available" title="aptana-code-feature" width="518" height="112" class="size-medium wp-image-1098" /></a><p class="wp-caption-text">Generate and wrap code at the touch of a button</p></div>
<p>A superb feature it must be said, but it is totally eclipsed when you start using the <a href="http://code.google.com/p/zen-coding/">Zen Coding JavaScript Library</a>. Zen Coding, written by Sergey Chikuyonok isn&#8217;t a JavaScript Library in the traditional sense, it isn&#8217;t uploaded and linked to in your web page; it&#8217;s installed as a plug-in for your selected <a href="http://code.google.com/p/zen-coding/downloads/list">text editor</a>. As you can see from <a href="http://code.google.com/p/zen-coding/downloads/list">the list</a> there are many versions available, so you aren&#8217;t restricted to only Aptana.</p>
<p>Let me explain what it does first, then I&#8217;ll show you how to install it (for Aptana). As a Front End Web Developer you will often find you&#8217;re writing out the same blocks of code again and again. You can just copy / paste then modify, but even that&#8217;s quite slow and tedious. Zen Coding uses a technology that you will be very familiar with: CSS selectors. It may seem confusing at first, but once you see it in action it makes perfect sense. Here are a few  code examples I use all the time:</p>
<div class="codecolorer-container html4strict default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">&lt;!--</span><br />
<span style="color: #808080; font-style: italic;">Entering</span><br />
<span style="color: #808080; font-style: italic;">ul#mainNav&gt;li*5&gt;a</span><br />
<span style="color: #808080; font-style: italic;">generates the list below</span><br />
<span style="color: #808080; font-style: italic;">--&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;mainNav&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span></div></td></tr></tbody></table></div>
<p>Using simple CSS selectors we&#8217;ve been able to quickly generate an unordered list that can be used for example, as a page navigation. You can even use more advanced selectors like siblings and abbreviated groups to generate more advanced HTML:</p>
<div class="codecolorer-container html4strict default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #808080; font-style: italic;">&lt;!--</span><br />
<span style="color: #808080; font-style: italic;">Entering</span><br />
<span style="color: #808080; font-style: italic;">div#wrapper&gt;div#header+div#content+div#footer</span><br />
<span style="color: #808080; font-style: italic;">generates this div set below</span><br />
<span style="color: #808080; font-style: italic;">--&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;wrapper&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;header&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;content&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;footer&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
<br />
<span style="color: #808080; font-style: italic;">&lt;!--</span><br />
<span style="color: #808080; font-style: italic;">Or a more advanced example</span><br />
<span style="color: #808080; font-style: italic;">div#content&gt;(div.primary-section&gt;h2.header+p+ul&gt;li*5)+(div.secondary-section&gt;h3+p)</span><br />
<span style="color: #808080; font-style: italic;">generates the sections below</span><br />
<span style="color: #808080; font-style: italic;">--&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;content&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;primary-section&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;header&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;secondary-section&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h3</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h3</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></div></td></tr></tbody></table></div>
<p>It may take a little while to get into the routine, it&#8217;s all to easy to slip back into typing the code by hand; but once you do you can build the basic mark-up of a page in a matter of minutes. </p>
<p>There&#8217;s a very informative article on <a href="http://www.smashingmagazine.com/2009/11/21/zen-coding-a-new-way-to-write-html-code/">Smashing Magazine</a> from last year which you may find useful if you plan on investigating Zen Coding further; I highly recommend adding it to your &#8220;toread&#8221; list. There are so many more functions available that I haven&#8217;t even touched on in this article, you will be amazed.</p>
<p>Now that you&#8217;ve seen Zen Coding in action you may be wondering how you install it for use with Aptana. Well luckily it&#8217;s dead simple. First create a &#8216;new project&#8217; in Aptana, call it whatever you like e.g. &#8216;Zen Coding&#8217;:</p>
<p><a href="http://nooshu.com/wp-content/uploads/2010/05/aptana-setup.gif"><img src="http://nooshu.com/wp-content/uploads/2010/05/aptana-setup-518x254.gif" alt="Simple to setup Aptana with Zen Coding" title="aptana-setup" width="518" height="254" class="alignnone size-medium wp-image-1102" /></a></p>
<p>Within the new project create a scripts directory and copy the Zen Coding JavaScript into into the directory. That&#8217;s it you&#8217;re done! Restart Aptana and start using Zen Coding. Once you&#8217;ve typed in a string of CSS selectors you wish to convert to HTML, hit CTRL + E (Expand Abbreviation) and it will do the rest for you. One thing to note, you must keep the new project you&#8217;ve just created open at all times, else Aptana won&#8217;t be able to access the scripts.</p>
<p>You can customise the key you use expand an abbreviation by editing the &#8220;Key&#8221; value in &#8220;Expand Abbreviation.js&#8221;. For more information on available keycodes see the <a href="http://docs.aptana.com/docs/index.php/Eclipse_Monkey_scripting_with_Ruby#Adding_metadata_to_your_script">Aptana documentation here</a>.</p>
<p>Hopefully you find Zen Coding useful, it&#8217;s certainly changed the way I code on a day to day basis.</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/aptana-on-steroids-using-zen-coding/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recommended books for Front End Web Developers</title>
		<link>http://nooshu.com/recommended-books-for-front-end-web-developers?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=recommended-books-for-front-end-web-developers</link>
		<comments>http://nooshu.com/recommended-books-for-front-end-web-developers#comments</comments>
		<pubDate>Tue, 27 Apr 2010 14:45:23 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Books]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=1053</guid>
		<description><![CDATA[Heres a list I recommend for any Front End Web Developer just starting out in the big wild virtual world or web development. ]]></description>
			<content:encoded><![CDATA[<p>So you&#8217;ve decided to persue a career as a Front End Web Developer (or you already are one and are looking for something new to read); smashing! The life of a Front End Developer is never dull&#8230; (cough) okay sometimes it is but there are certainly some exciting technologies out there to play with, especially at the moment with HTML5 and CSS3 gaining popularity.</p>
<p>Like with anything, you need to have a solid foundation of knowledge to build upon when it comes to new technologies, sometimes it&#8217;s a little dull but it will pay dividends in the future. Once you have the basic knowledge the world is you web browser. So here are a list of five books I&#8217;ve read in the past that I&#8217;ve found particularity helpful.</p>
<p><a href="http://nooshu.com/wp-content/uploads/2010/04/books.jpg"><img src="http://nooshu.com/wp-content/uploads/2010/04/books-518x360.jpg" alt="Looking for new Front End books to read, you could try one of these." title="recommended books" width="518" height="360" class="alignnone size-medium wp-image-1056" /></a></p>
<h3>DOM Scripting</h3>
<p>The reason I&#8217;ve put this book first is simply because it&#8217;s one of the best technical books I&#8217;ve ever read. The way it&#8217;s written is simple to understand and concise. All the way through the book it explains not only what you are doing but also <strong>why</strong> you&#8217;re doing it, and why you should also follow the same methodology.</p>
<p>If you are a complete beginner to JavaScript and the DOM this book will get you up and running and understanding in just a couple of chapters. Now some may say &#8220;oh I don&#8217;t need to know this anymore, that&#8217;s what JavaScript librarys are for&#8221;, but in my opinion that&#8217;s a dangerous road to go down. If ever your chosen library doesn&#8217;t do what you need, or if you can&#8217;t use a library for whatever reason; then you&#8217;re in trouble. </p>
<p>If you know the basics of the DOM and how to manipulate it using JavaScript, you&#8217;re much more likely to solve any issues you encounter and you&#8217;ll have a much better understanding of what the libraries are actually doing.</p>
<p>Author: Jeremy Keith (<a href="http://www.amazon.co.uk/DOM-Scripting-Design-JavaScript-Document/dp/1590595335">Amazon</a>).</p>
<h3>Eric Meyer on CSS</h3>
<p>There simply couldn&#8217;t be a review of front end development books without a book from the wizard of CSS, Eric Meyer. Eric has been a major part of the CSS community for many years; helping to educate developers in the proper usage of CSS and how it can make development so (so!) much easier. I had the pleasure of attending a 2 day workshop of his in London a few years back, and still use what I learnt there on a day to day basis.</p>
<p>&#8216;Eric Meyer on CSS&#8217; will teach you some of the advanced techniques involved in using CSS in a practical manner. You take a plain website built using tables, clean up the mark-up and layer on features and functionality using CSS over the various chapters; so rather than just getting a list of properties and selectors to read about, you actually get to see a live project changing over time.</p>
<p>Be warned, the book isn&#8217;t for absolute beginners, you do really need to know the basics of HTML and CSS to get the most out of it. Not to worry though, all the information you need to learn the basics of many different languages including HTML and CSS is available online at  <a href="http://www.w3schools.com/">w3schools</a>. You don&#8217;t have to stick to HTML and CSS, they also have JavaScript and the DOM if you&#8217;re feeling adventurous.</p>
<p>Author: Eric Meyer (<a href="http://www.amazon.com/Eric-Meyer-CSS-Mastering-Language/dp/073571245X">Amazon</a>) </p>
<h3>JavaScript &#8211; The Definitive Guide</h3>
<p>The very large book you can see in the image above is &#8216;JavaScript &#8211; The Definitive Guide&#8217;, and it really is a definitive guide. It has of 900+ pages of wonderful JavaScript! Now I wouldn&#8217;t expect anyone to read it page by page (although that&#8217;s what I did), but it&#8217;s defiantly a book you should have in your tool kit for reference. It  goes over pretty much all aspects of JavaScript you will ever use and even though it is quite technical it isn&#8217;t hard to follow; with plenty of examples and explanation of the code.</p>
<p>Again there&#8217;s an argument for do you need to know JavaScript if you just intend on using a library. Well I guess that up to you, but I personally don&#8217;t feel comfortable using any sort of framework / abstraction without having at least some understanding of the language it is built on.</p>
<p>Author: David Flanagon (<a href="http://www.amazon.com/JavaScript-Definitive-Guide-Activate-Pages/dp/0596805527/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1272375736&#038;sr=1-1">Amazon</a>) </p>
<h3>Learning jQuery</h3>
<p>So assuming you know about HTML, CSS and JavaScript it&#8217;s time to learn one of the many JavaScript libraries available. Now I agree with Christian Heilmann on a point he made at Full Frontal 2009 (I think it was Christian who made it), it doesn&#8217;t matter what library you use, as long as you use one!</p>
<p>&#8216;Learning jQuery&#8217; is a fantastic book that will take you through all aspects of jQuery, from setting up and writing basic code to Ajax and writing your own jQuery plug-ins. If you know how to use CSS to select parts of the DOM then jQuery will be simple for you to pick up and use. The book is filled with practical examples and applications, all using best practice methods.</p>
<p>I only had one slight gripe with the book while reading it; I found the font for the code blocks was slightly too big, so you tended to get a lot of wrapping on large code blocks. In terms of the content though, it really is one book that is a must read if you use jQuery or want to use jQuery in your projects.</p>
<p>Author: Jonathan Chaffer &#038; Karl Swedberg (<a href="http://www.amazon.com/Learning-jQuery-1-3-Jonathan-Chaffer/dp/1847196705/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1272376954&#038;sr=8-1">Amazon</a>)</p>
<h3>PHP Solutions</h3>
<p>Now I know what you may be thinking, PHP isn&#8217;t a front end language, it&#8217;s a server side language. That is very true, but one thing I can guarantee is one day you will have to integrate the front end templates you&#8217;ve built into a server side language; be that PHP, .Net, JSP, Java etc. As I&#8217;ve mainly worked with open source technologies, PHP is primarily what I integrate into.</p>
<p>&#8216;PHP Solutions&#8217; is another excellent Friends of Ed book that takes you through lots of practical uses of PHP that you can use straight out of the book. It covers subjects such as setting up your server and includes, to online galleries and security.  You may not use any of the functionality it covers since most frameworks and CMS&#8217;s have the functionality built in; but it will give you an understanding of how PHP works as a language which in turn will help you when it comes to integration.</p>
<p>Author: David Powers (<a href="http://www.amazon.co.uk/PHP-Solutions-Dynamic-Design-Made/dp/1590597311">Amazon</a>)</p>
<p>So there you have 5 books I&#8217;d recommend to any Front End Web Developer looking to expand their client-side knowledge. Leave a comment if there are any books you&#8217;d recommend and I&#8217;ll take a look and add it to my Amazon wishlist.</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/recommended-books-for-front-end-web-developers/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Content using CSS3</title>
		<link>http://nooshu.com/adding-content-using-css3?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=adding-content-using-css3</link>
		<comments>http://nooshu.com/adding-content-using-css3#comments</comments>
		<pubDate>Tue, 20 Apr 2010 18:48:17 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[css3]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=988</guid>
		<description><![CDATA[With CSS3 it is now possible to add content to the page only using CSS. The content / layout lines are blurring just a little...]]></description>
			<content:encoded><![CDATA[<p>CSS3 is an exciting new browser technology, it&#8217;s implementation is improving with every new browser release. Microsoft is adding a whole host of CSS3 selectors to the their next version of Internet Explorer, version 9. Until IE9 is released and the vast majority of users start using it, (2016 maybe?) it&#8217;s a case of having to use CSS3 quite cautiously. </p>
<p>Using the &#8216;progressive enhancement&#8217; methodology, we build a website that works in all browsers first, then &#8216;layer on&#8217; the cool features and &#8216;nice to haves&#8217; after, so users with modern browsers get the full site experience and older browsers still have access to all the content. CSS3 sits in the &#8216;nice to have&#8217; category for the moment.</p>
<p>While looking through the <a href="http://www.w3.org/TR/css3-content/">W3C CSS3 Working Draft</a> I came across a section called &#8216;Inserting content into an element&#8217;. The CSS3 pseudo-elements listed here are used to add content to the page using CSS. Cool! &#8230;.wait a second; for years we&#8217;ve been separating layout from content, allowing us to easily edit a whole website layout from a single file. The pseudo-elements seem to be going against this mantra! Uh ohh! It&#8217;s controversial, but I believe if used responsibly the pseudo-elements shouldn&#8217;t cause any major accessibility issues.</p>
<p><strong>::before &#038; ::after</strong><br />
The ::before and ::after pseudo-elements are used to add content before and after the content inside the selected element (surprising huh!):</p>
<div class="codecolorer-container css default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #cc00cc;">#element</span><span style="color: #00AA00;">:</span><span style="color: #3333ff;">:before </span><span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;Paradox: &quot;</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #00AA00;">&#125;</span><br />
<span style="color: #cc00cc;">#element</span><span style="color: #00AA00;">:</span><span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot; Now my head hurts.&quot;</span><br />
&nbsp; &nbsp; <span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>View a <a href="http://nooshu.com/explore/css3-selectors/before-after.html">demo here</a>.</p>
<p>The specifications even allow you to add more content by iterating the pseudo-elements, so ::after::after (or ::after(2)) but this isn&#8217;t supported in current browsers I have tested. I&#8217;m personally hoping that part of the specification isn&#8217;t implemented, as you can have too much of a good thing. You could end up in the nightmare situation of pages completely generated using CSS3 using multiple levels of ::before and ::after.</p>
<p>The CSS3 specification has also outlined the pseudo-element ::outside but it hasn&#8217;t been implemented yet in the current version of Firefox I&#8217;m using (3.6.3). </p>
<p>Outline will allow you to wrap an element inside another element and then add styling to it. Usually you&#8217;d modify the source code by adding extra divs to do this, but it isn&#8217;t always possible. Outline would have been very useful over the past couple of years for adding &#8216;sliding doors&#8217; and rounded corners where needed, without having to clutter up the mark-up with &#8216;for style&#8217; only tags. Oh well it&#8217;s a tool for the future.</p>
<p>I can&#8217;t say I&#8217;m a big fan of these new pseudo-elements as they seem to be stepping on HTML&#8217;s toes. It&#8217;s hard to think of a situation where you&#8217;d want the CSS to be writing content to the pages since it isn&#8217;t accessible to screen readers or search engines, but I&#8217;m sure there are some. The only example that springs to mind is when you add a &#8216;:&#8217; after the label on a form field, you don&#8217;t want a screen reader to read out the &#8216;colon&#8217; so you add it using CSS.</p>
<p>I&#8217;d love to hear where other people plan on using ::before and ::after, or where you are using them at the moment.</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/adding-content-using-css3/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NASA Picture of the Day CSS Design Challenge</title>
		<link>http://nooshu.com/nasa-picture-of-the-day-css-design-challenge?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nasa-picture-of-the-day-css-design-challenge</link>
		<comments>http://nooshu.com/nasa-picture-of-the-day-css-design-challenge#comments</comments>
		<pubDate>Wed, 31 Mar 2010 22:29:20 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Experiments]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[markup]]></category>
		<category><![CDATA[nasa]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=513</guid>
		<description><![CDATA[NASA's Astronomy Picture of the Day website looks terrible, using some CSS3 and Firefox you can make it a little more presentable.]]></description>
			<content:encoded><![CDATA[<p>A website I check on a regular basis is the <a href="http://antwrp.gsfc.nasa.gov/apod/archivepix.html">NASA&#8217;s Astronomy Picture of the Day</a>, a superb site if you&#8217;re interested in the Cosmos; it publishes a new picture each day with an explanation written by a professional astronomer. Amazing stuff&#8230; apart from the design is&#8230; just horrible! If you want an example of what the web looked like back in the mid nineties, then take a <a href="http://antwrp.gsfc.nasa.gov/apod/astropix.html">look</a>.</p>
<p>Now I doubt restyling the website is high up on NASA&#8217;s priority list, but there&#8217;s no reason a user can&#8217;t do it for them (only on their own machine of-course). All you need is Firefox and a custom CSS file.</p>
<p>The CSS file you will need is called userContent.css, and it resides in your Firefox profile under the &#8216;chrome&#8217; directory. To find your profile directory look under &#8216;Help&#8217; > &#8216;Troubleshooting information&#8230;&#8217;, there you will see a button to open the profile directory (<strong>Note</strong>: I wouldn&#8217;t change much in here, it can break your profile!). If you still can&#8217;t find it you can always look <a href="http://support.mozilla.com/en-US/kb/Profiles#Where_is_my_profile_stored_">here</a>. You may not have a userContent.css by default, so feel free to create a blank one.</p>
<p>This is when the fun starts, first you want to add this code snippet:</p>
<div class="codecolorer-container css default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #a1a100;">@-moz-document domain(antwrp.gsfc.nasa.gov) {</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* Page specific CSS here */</span>&nbsp; &nbsp; <br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>This is a Mozilla specific property that will allow you to include CSS for pages on a specific domain; note the &#8216;antwrp.gsfc.nasa.gov&#8217;. Feel free to add as little or as much CSS as you want until you are happy with the page layout. Here&#8217;s a sample from the userContent.css file I created:</p>
<div class="codecolorer-container css default customCodeColor" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #a1a100;">@-moz-document domain(antwrp.gsfc.nasa.gov) {</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* authors and editors */</span><br />
&nbsp; &nbsp; body <span style="color: #00AA00;">&gt;</span> hr ~ <span style="color: #993333;">center</span><span style="color: #3333ff;">:nth-</span>child<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #00AA00;">&#41;</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0.69em</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* all b's */</span><br />
&nbsp; &nbsp; body <span style="color: #00AA00;">&gt;</span> hr ~ <span style="color: #993333;">center</span><span style="color: #3333ff;">:nth-</span>child<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #00AA00;">&#41;</span> b <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">8px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1em</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">1.4</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #00AA00;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* first b */</span><br />
&nbsp; &nbsp; body <span style="color: #00AA00;">&gt;</span> hr ~ <span style="color: #993333;">center</span><span style="color: #3333ff;">:nth-</span>child<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #00AA00;">&#41;</span> b<span style="color: #3333ff;">:nth-</span>child<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #00AA00;">&#41;</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">32px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #808080; font-style: italic;">/* all a's */</span><br />
&nbsp; &nbsp; body <span style="color: #00AA00;">&gt;</span> hr ~ <span style="color: #993333;">center</span><span style="color: #3333ff;">:nth-</span>child<span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #00AA00;">&#41;</span> a <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1em</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span> <br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>To make the page look in any way presentable I&#8217;ve had to rely heavily on the new <a href="http://www.w3.org/TR/css3-selectors/">CSS3 selectors</a> available in most modern browsers; as the state of the mark-up on the pages is truly awful. I guess it all adds to the challenge though, it&#8217;s certainly a great way to learn CSS3.</p>
<p>Here are a couple of before and after images I created, nothing spectacular but hopefully it looks slightly better:</p>
<div id="attachment_519" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2010/03/archive-before-after.gif"><img src="http://nooshu.com/wp-content/uploads/2010/03/archive-before-after-518x172.gif" alt="Nasa picture archive, before and after." title="nasa-archive-before-after" width="518" height="172" class="size-medium wp-image-519" /></a><p class="wp-caption-text">Before and after screenshot of the archive page.</p></div>
<div id="attachment_522" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2010/03/picture-before-after.jpg"><img src="http://nooshu.com/wp-content/uploads/2010/03/picture-before-after-518x228.jpg" alt="Nasa picture of the day, before after" title="picture-before-after" width="518" height="228" class="size-medium wp-image-522" /></a><p class="wp-caption-text">Before and after screenshot of the daily picture page.</p></div>
<p>The &#8216;index&#8217; page was a page to far for me, I have no idea what the developer was trying to do with the mark-up, it&#8217;s overuse of tables for layout really doesn&#8217;t help either. On the end I got bored but feel free to dive in and take a look.</p>
<p>It&#8217;s also worth mentioning that it is possible to customise the style of any website using a Firefox plug-in called <a href="https://addons.mozilla.org/en-US/firefox/addon/2108">Stylish</a>, you can view many examples of it&#8217;s usage on <a href="http://userstyles.org/">userstyles.org</a>.</p>
<p>Here&#8217;s the link to <a href="http://nooshu.com/wp-content/uploads/downloads/userContent.css">download the userContent.css</a> I created, I&#8217;d love to see what other designs people can come up with using some CSS3 and NASA&#8217;s horendus mark-up!</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/nasa-picture-of-the-day-css-design-challenge/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful websites for a Front-End Web Developer</title>
		<link>http://nooshu.com/useful-websites-for-a-front-end-web-developer?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=useful-websites-for-a-front-end-web-developer</link>
		<comments>http://nooshu.com/useful-websites-for-a-front-end-web-developer#comments</comments>
		<pubDate>Mon, 01 Mar 2010 10:53:22 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[sites]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[useful]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=330</guid>
		<description><![CDATA[Here are a few websites I'd like to share with you, they can really speed up your working process.]]></description>
			<content:encoded><![CDATA[<p>Over the past few days I&#8217;ve compiled a list of websites I use quite frequently that really help speed up the Web Development process. The sites won&#8217;t build your pages for you but they can certainly help when it comes to debugging and problem solving.</p>
<h3>Clean CSS</h3>
<p>I have been using <a href="http://cleancss.com/">Clean CSS</a> for a few years now to clean up and optimise my CSS. The tool will give you a break down of where you can be making optimisations and also point out potential issues with invalid properties. You can either apply the changes manually, as it gives you a line number (my prefered method) or you can download the output as a file. I must admit I only use it every so often as I&#8217;ve merged most of the optimisations into my working process.</p>
<p>An exception to that rule is when working with other peoples CSS, it&#8217;s always my first port of call. There&#8217;s even the ability to create your own template, so the CSS can be formatted just as you like it when it comes out the other end.</p>
<div id="attachment_333" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2010/03/FireShot-capture-063-Cl.gif"><img src="http://nooshu.com/wp-content/uploads/2010/03/FireShot-capture-063-Cl-518x451.gif" alt="CleanCSS GUI" title="CleanCSS - CSS optimisation made easy" width="518" height="451" class="size-medium wp-image-333" /></a><p class="wp-caption-text">The CleanCSS interface simple to use with lots of options to play with.</p></div>
<h3>Snipplr</h3>
<p><a href="http://snipplr.com/">Snipplr</a> has been around for a couple of years now, it&#8217;s a excellent place to store all those little snippets of code that you often use. You can view other peoples snippets too, so if you&#8217;re looking to a solution to a problem there&#8217;s no need to re-invent the wheel; look see if someone else has a solution.</p>
<p>The only real issue I have with <a href="http://snipplr.com/">Snipplr</a> is the amount of spam it receives, which is a real pity as it&#8217;s such a useful tool. Maybe that&#8217;s something the developers can look into fixing.</p>
<h3>Em Calculator</h3>
<p>For a few years now I&#8217;ve been setting my font sizes using the relative unit em&#8217;s rather than pixels or points. This was due to the fact that if you set your font size in pixels, IE6 users can&#8217;t increase the font size due to IE6 being&#8230; erm&#8230; a truly awful browser; not good at all for accessibility. Luckily IE6 is gradually fading away and IE7+ all scale font sizes properly, so in the future this tool won&#8217;t be needed.</p>
<p>The problem with using relative font sizes comes when you have a nested elements. Say you have an unordered list with its font size set to 12px (0.75em) and you want one of your list items to be set to 10px (0.63em). Since we are using relative font sizes the 0.75em has an effect on the lower list items. If you simply set the the list item to 0.63em the text size will be tiny because you are asking the browser to set a size of 0.63em <strong>of</strong> 0.75em. Not what we wanted at all! This is where <a href="http://riddle.pl/emcalc/">Em Calculator</a> comes in useful as it does all the calculations for you. You actually needed to set the list item to 0.83em&#8230;.duh!</p>
<div id="attachment_336" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2010/03/FireShot-capture-064-Em.gif"><img src="http://nooshu.com/wp-content/uploads/2010/03/FireShot-capture-064-Em-518x237.gif" alt="Em Calculator interface for quick relative font size calculations " title="Em font sizes are easy with this toom" width="518" height="237" class="size-medium wp-image-336" /></a><p class="wp-caption-text">An example of how Em Calculator works with my example unordered list.</p></div>
<h3>jsFiddle</h3>
<p>I&#8217;ve mentioned <a href="http://www.jsfiddle.net/">jsFiddle</a> before, it&#8217;s a tool that allows you experiment with HTML, CSS and JavaScript and see the results on the same page. In the past couple of days they&#8217;ve added a new version of Processing and the RaphaelJS library. A link to my previous post on jsFiddle is available <a href="http://nooshu.com/jsfiddle-my-new-favourite-website/">here</a>.</p>
<h3>HTML Entity Character Lookup</h3>
<p>If you&#8217;ve ever had to build a set of multi-lingual HTML emails you will know how tedious it can be to encode all  characters so they are valid HTML. Lucky with <a href="http://leftlogic.com/lounge/articles/entity-lookup/">HTML Entity Character Lookup</a> by LeftLogic it&#8217;s simple. Copy and paste the character you want to encode into the tool and it will give you encoded version; do a quick search and replace then you&#8217;re done.</p>
<div id="attachment_340" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2010/03/FireShot-capture-065-HT.gif"><img src="http://nooshu.com/wp-content/uploads/2010/03/FireShot-capture-065-HT-518x587.gif" alt="HTML Entity Character Lookup by Leftlogic" title="HTML Entity lookup" width="518" height="587" class="size-medium wp-image-340" /></a><p class="wp-caption-text">Quickly lookup character entity's using Leftlogics tool.</p></div>
<p>For OS X users there&#8217;s also a dashboard widget you can use for easy access.</p>
<h3>CSS Sprite Generator</h3>
<p>Using the sprites method can speed up your page load time by minimising the number of HTTP Requests a users browser has to make to the server. It involves consolidating all your little icons and background images into one file, then moving that one image around using the background-position property.</p>
<p>You could do this manually in Photoshop, or you could get an on-line tool to do it for you. <a href="http://spritegen.website-performance.org/">CSS Sprite Generator</a> is my favourite of the sprite generators available. Simply ZIP up the files you want to sprite, upload them to the tool and it will return one large image and all the relevant CSS background-positions for you to copy / paste into your CSS file.</p>
<p>It&#8217;s particularly useful when it comes to site navigations. Having the off, on and hover states all in one background image means the user doesn&#8217;t see that ugly flash of unstyled content as hovering over the navigation bar, since all states are loaded when the user first hits the page.</p>
<p>Are there any others I&#8217;m missing? Post a reply if there are others you use.</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/useful-websites-for-a-front-end-web-developer/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jsFiddle: My new favourite website</title>
		<link>http://nooshu.com/jsfiddle-my-new-favourite-website?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jsfiddle-my-new-favourite-website</link>
		<comments>http://nooshu.com/jsfiddle-my-new-favourite-website#comments</comments>
		<pubDate>Tue, 23 Feb 2010 20:45:52 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[Vanilla JavaScript]]></category>
		<category><![CDATA[Inspiration]]></category>
		<category><![CDATA[ramble]]></category>

		<guid isPermaLink="false">http://nooshu.com/?p=312</guid>
		<description><![CDATA[jsFiddle just keeps getting better and better, the perfect tool for demonstrating your code snippets.]]></description>
			<content:encoded><![CDATA[<p>Every so often you come across a site that is so amazingly obvious that you think &#8220;why didn&#8217;t I think of that!&#8221;, <a href="http://jsfiddle.net/">jsFiddle</a> is one of those sites. It allows you to paste your HTML, CSS and JavaScript code, and view the result all in the same page&#8230;simple! There are other sites out there that do the same such as <a href="http://jsbin.com/">Jsbin</a>, but they just don&#8217;t do it as well.</p>
<p>My favourite feature that really stands out is being able to include one of the many popular JavaScript library&#8217;s by simple toggling a drop-down box; it even has different versions of each library to choose from. This is a really handy feature if you are a plug-in developer; keep your plug-in code in jsFiddle and quickly see if the latest version of the library breaks it.</p>
<div id="attachment_315" class="wp-caption alignnone" style="width: 528px"><a href="http://nooshu.com/wp-content/uploads/2010/02/jsfiddle-code-snippet-websi.gif"><img src="http://nooshu.com/wp-content/uploads/2010/02/jsfiddle-code-snippet-websi-518x253.gif" alt="jsFiddle code snippet GUI" title="jsfiddle code demo website" width="518" height="253" class="size-medium wp-image-315" /></a><p class="wp-caption-text">Quickly view your code change at the touch of a button</p></div>
<p>Library&#8217;s included so far are:</p>
<ul>
<li>Mootools Core</li>
<li>jQuery</li>
<li>Prototype</li>
<li>YUI</li>
<li>BBC Glow</li>
<li>Dojo</li>
<li>Processing.js</li>
</ul>
<p>A couple of other features available are the easy to access code examples for each library and ability to run Ajax requests directly in the page. It&#8217;s like a mini IDE in your browser, all it needs now is an error console; maybe that is on their to-do list. If you don&#8217;t use JavaScript library&#8217;s and just want vanilla JavaScript, they have that option too.</p>
<p>As an example I&#8217;ve added my <a href="http://nooshu.com/jquery-plug-in-characters-left/">charactersLeft</a> jQuery plug-in to jsFiddle, take a look <a href="http://jsfiddle.net/PDEQU/6/">here</a>. Very cool huh!</p>
]]></content:encoded>
			<wfw:commentRss>http://nooshu.com/jsfiddle-my-new-favourite-website/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

