<?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>CSS-Plus</title>
	<atom:link href="http://css-plus.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://css-plus.com</link>
	<description>Dance with CSS and Javascript</description>
	<lastBuildDate>Thu, 29 Mar 2012 05:32:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Gaussian Blur and CSS3/SVG</title>
		<link>http://css-plus.com/2012/03/gaussian-blur/</link>
		<comments>http://css-plus.com/2012/03/gaussian-blur/#comments</comments>
		<pubDate>Tue, 27 Mar 2012 15:15:16 +0000</pubDate>
		<dc:creator>cssplus-admin</dc:creator>
				<category><![CDATA[Article]]></category>

		<guid isPermaLink="false">http://css-plus.com/?p=1462</guid>
		<description><![CDATA[Gaussian blur is something I use a lot when it comes to Photoshop. It would be very handy to have that kind of &#8216;filter&#8217; power within a browser environment. Before we get started, I think it&#8217;s just important to understand &#8230; <a href="http://css-plus.com/2012/03/gaussian-blur/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Gaussian blur is something I use a lot when it comes to Photoshop. It would be very handy to have that kind of &#8216;filter&#8217; power within a browser environment.<br />
<span id="more-1462"></span><br />
Before we get started, I think it&#8217;s just important to understand that both the <abbr title="Scalable Vector Graphics">SVG</abbr> and CSS filter properties affect an element and all of it&#8217;s children. A child element cannot be &#8216;un-blurred&#8217;, only blurred more. There are a few methods of recreating this Gaussian blur effect, some work cross-browser, others don&#8217;t but will be supported in future. </p>
<p>In the example jsfiddles you may notice <abbr title="Hypertext Markup Language">HTML</abbr> IE conditional statements: Usually those conditional statements are applied to the <code>&lt;html&gt;</code> element and I&#8217;ve added them to a div to mimic that functionality.</p>
<h2>CSS3 text-shadow<img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-chrome.png" alt="Chrome Logo" title="Supported by Chrome" width="32" height="32" class="alignright size-full wp-image-1500" /><img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-firefox.png" alt="Firefox Logo" title="Supported by Firefox" width="32" height="32" class="alignright size-full wp-image-1501" /><img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-ie.png" alt="Internet Explorer Logo" title="Supported by Internet Explorer" width="32" height="32" class="alignright size-full wp-image-1502" /><img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-opera.png" alt="Opera Logo" title="Supported by Opera" width="32" height="32" class="alignright size-full wp-image-1503" /><img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-safari.png" alt="Safari Logo" title="Supported by Safari" width="32" height="32" class="alignright size-full wp-image-1504" /></h2>
<p>I&#8217;m sure you&#8217;re either aware of, or easily understand how this trick works. Very simply, you give the text a text-shadow and make the it transparent so that only the shadow is visible. This gives a simple and effective blurred text effect. Usually I would detect for IE9 but it&#8217;s necessary in this case since IE9 doesn&#8217;t support text-shadow.<br />
<iframe style="width: 100%; height: 300px;" src="http://jsfiddle.net/jamygolden/CGFBT/2/embedded/result,html,css/" frameborder="0" width="320" height="240"></iframe></p>
<h3>Problems</h3>
<ul>
<li>Opera doesn&#8217;t currently support the transition to the text-shadow property. The blur works well though!</li>
<li>I&#8217;ve applied a lte-IE8 shadow filter to the text. It looks more like a smudge than a blur, but there you have it &#8211; use it, don&#8217;t use it.</li>
</ul>
<h3>Fallback</h3>
<p>Use <a href="http://www.modernizr.com/">Modernizr</a> ( or feature detect manually ) for text-shadow support to apply fallback styles. This is necessary due to the fact that the text has a transparent color and without the shadow, the font is illegible.</p>
<h2><abbr title="Scalable Vector Graphics">SVG</abbr> blur filter applied to a <abbr title="Scalable Vector Graphics">SVG</abbr> element<img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-chrome.png" alt="Chrome Logo" title="Supported by Chrome" width="32" height="32" class="alignright size-full wp-image-1500" /><img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-firefox.png" alt="Firefox Logo" title="Supported by Firefox" width="32" height="32" class="alignright size-full wp-image-1501" /><img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-opera.png" alt="Opera Logo" title="Supported by Opera" width="32" height="32" class="alignright size-full wp-image-1503" /></h2>
<p>The title may seem superfluous but it&#8217;s actually quite important to understand when it comes to <abbr title="Scalable Vector Graphics">SVG</abbr> filters. <abbr title="Scalable Vector Graphics">SVG</abbr> supports filters and we can easily and freely apply these filters to all kinds of <abbr title="Scalable Vector Graphics">SVG</abbr> elements. Note: <em>NOT</em> all kinds of <em>HTML</em> elements, I&#8217;ll elaborate a little later.<br />
<iframe style="width: 100%; height: 300px;" src="http://jsfiddle.net/jamygolden/2S6Ut/1/embedded/result,html,css/" frameborder="0" width="320" height="240"></iframe></p>
<h3>Problems</h3>
<ul>
<li>Chrome isn&#8217;t currently able to apply a <abbr title="Scalable Vector Graphics">SVG</abbr> filter if one has already been applied to an element. This means: if a <abbr title="Scalable Vector Graphics">SVG</abbr> element contains a filter, another filter won&#8217;t be applied via class change, hover or any other CSS pseudo class.</li>
<li>IE6-IE8 doesn&#8217;t support <abbr title="Scalable Vector Graphics">SVG</abbr> within HTML. They see these tags as made up tags and treats them as that. They elements are not able to be styled unless the <abbr title="Scalable Vector Graphics">SVG</abbr> is wrapped in an element and that wrapper element is styled. Alternatively document.createElement() could be used (This is what the HTML5 shim/shiv makes use of. more about it by Paul Irish).</li>
<li>No browser supports the transition property being applied to a <abbr title="Scalable Vector Graphics">SVG</abbr> element</li>
</ul>
<h2><abbr title="Scalable Vector Graphics">SVG</abbr> blur filter applied to a <abbr title="Scalable Vector Graphics">SVG</abbr> image element<img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-chrome.png" alt="Chrome Logo" title="Supported by Chrome" width="32" height="32" class="alignright size-full wp-image-1500" /><img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-firefox.png" alt="Firefox Logo" title="Supported by Firefox" width="32" height="32" class="alignright size-full wp-image-1501" /><img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-opera.png" alt="Opera Logo" title="Supported by Opera" width="32" height="32" class="alignright size-full wp-image-1503" /></h2>
<p>Most of us want to apply a blur filter to images so the above example is all well and good, but it probably won&#8217;t be of too much assistance since the CSS3 text-shadow blur does the same thing. We&#8217;re not able to drop &lt;img&gt; elements into <abbr title="Scalable Vector Graphics">SVG</abbr> an image, luckily <abbr title="Scalable Vector Graphics">SVG</abbr> has it&#8217;s own way of inserting external images. Suddenly this gives us quite a lot of freedom when it comes to Gaussian blur or <a href="https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html">other</a> <a href="http://updates.html5rocks.com/2011/12/CSS-Filter-Effects-Landing-in-WebKit">SVG filters</a>.<br />
<iframe style="width: 100%; height: 300px;" src="http://jsfiddle.net/jamygolden/yUG5U/2/embedded/result,html,css/" frameborder="0" width="320" height="240"></iframe></p>
<h3>Most of the above problems apply here as well as a few more:</h3>
<ul>
<li>Chrome can&#8217;t apply a <abbr title="Scalable Vector Graphics">SVG</abbr> filter if one has already been applied, however there is a work around for this in <a href="http://tools.google.com/dlpage/chromesxs">Chrome</a><a href="http://tools.google.com/dlpage/chromesxs">Canary</a>. If you apply a filter to a parent <abbr title="Scalable Vector Graphics">SVG</abbr> element and a hover filter to the child element, the hover effect will take place.</li>
<li>No browser supports the transition property being applied to an <abbr title="Scalable Vector Graphics">SVG</abbr> element</li>
<li>IE9 renders the image (without an applied filter), But lte-IE8 doesn&#8217;t display the image whatsoever.</li>
</ul>
<h2><abbr title="Scalable Vector Graphics">SVG</abbr> Blur Filter applied to <abbr title="Hypertext Markup Language">HTML</abbr> elements<img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-firefox.png" alt="Firefox Logo" title="Supported by Firefox" width="32" height="32" class="alignright size-full wp-image-1501" /></h2>
<p><iframe style="width: 100%; height: 300px;" src="http://jsfiddle.net/jamygolden/saR88/1/embedded/result,html,css/" frameborder="0" width="320" height="240"></iframe></p>
<h3>Problems</h3>
<ul>
<li>Firefox is the only browser that supports this</li>
<li>The transition property still doesn&#8217;t take affect when applied</li>
</ul>
<h2>CSS Blur Filter<a href="http://tools.google.com/dlpage/chromesxs"><img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-chrome-canary.png" alt="Chrome Canary Logo" title="Supported by Chrome Canary" width="32" height="32" class="alignright size-full wp-image-1514" /></a></h2>
<p>This is where it all gets very exciting. A CSS property that fully supports all kinds of filters including the most important one (for this article at least), the blur filter. It is more simple to use than you could ever imagine – element { filter: blur(2px) }</p>
<p>Unfortunately this can&#8217;t be applied to <abbr title="Scalable Vector Graphics">SVG</abbr> elements, however there is a bit of a work around: You can wrap the <abbr title="Scalable Vector Graphics">SVG</abbr> element within an <abbr title="Hypertext Markup Language">HTML</abbr> tag and apply the CSS filter to that. The only draw back is that the entire <abbr title="Scalable Vector Graphics">SVG</abbr> element will be blurred, and not a single element.<br />
<iframe style="width: 100%; height: 300px;" src="http://jsfiddle.net/jamygolden/3asZC/2/embedded/result,html,css/" frameborder="0" width="320" height="240"></iframe><br />
It&#8217;s merely a filter property with a blur value applied. Absolutely amazing. On top of everything, since it&#8217;s a standard CSS property, the transition property works perfectly. You can transition from a normal image, to a half blurred/half grey scale image if you&#8217;d like. It&#8217;s all up to your imagination.</p>
<h3>Problems</h3>
<ul>
<li>The only &#8216;browser&#8217; that currently supports this is <a href="http://tools.google.com/dlpage/chromesxs">Chrome</a><a href="http://tools.google.com/dlpage/chromesxs">Canary</a></li>
</ul>
<p>The &#8220;problem&#8221; is quite a large set back here. The only browser that supports this is a nightly browser version &#8211; This means that we should pretty much stay away from it until at least 2 popular browsers support it&#8230; Right?</p>
<h3>I think you could use it now actually</h3>
<ul>
<li>As long as it&#8217;s not an absolutely dependant feature, browsers will degrade gracefully &#8211; If the property isn&#8217;t supported, the image is unaffected.</li>
<li>It should be supported in Chrome pretty soon</li>
<li>You could use the CSS filter (webkit only) along with the <abbr title="Scalable Vector Graphics">SVG</abbr> filter applied to an <abbr title="Hypertext Markup Language">HTML</abbr> element (firefox only)</li>
</ul>
<p>Here is an example of the CSS Filter used alongside the <abbr title="Scalable Vector Graphics">SVG</abbr> filter.<br />
<iframe style="width: 100%; height: 300px;" src="http://jsfiddle.net/jamygolden/3asZC/3/embedded/result,html,css/" frameborder="0" width="320" height="240"></iframe><br />
<a href="http://updates.html5rocks.com/2011/12/CSS-Filter-Effects-Landing-in-WebKit">HTML</a><a href="http://updates.html5rocks.com/2011/12/CSS-Filter-Effects-Landing-in-WebKit">5</a><a href="http://updates.html5rocks.com/2011/12/CSS-Filter-Effects-Landing-in-WebKit">Rocks</a> has a cool article and demo about this property &#8211; Keep in mind the demo currently only works in Chrome Canary.</p>
<h2>Good old fashioned images<img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-chrome.png" alt="Chrome Logo" title="Supported by Chrome" width="32" height="32" class="alignright size-full wp-image-1500" /><img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-firefox.png" alt="Firefox Logo" title="Supported by Firefox" width="32" height="32" class="alignright size-full wp-image-1501" /><img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-ie.png" alt="Internet Explorer Logo" title="Supported by Internet Explorer" width="32" height="32" class="alignright size-full wp-image-1502" /><img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-opera.png" alt="Opera Logo" title="Supported by Opera" width="32" height="32" class="alignright size-full wp-image-1503" /><img src="http://css-plus.com/wp-content/uploads/2012/03/32x32-safari.png" alt="Safari Logo" title="Supported by Safari" width="32" height="32" class="alignright size-full wp-image-1504" /></h2>
<p>This is obviously the most popular at the moment due to the browser support.<br />
<iframe style="width: 100%; height: 600px;" src="http://jsfiddle.net/jamygolden/xG6bb/embedded/result,html,css" frameborder="0" width="320" height="240"></iframe></p>
<h3>Problems</h3>
<ul>
<li>Increased page size due to extra images</li>
<li>Increased HTTP requests (if you don&#8217;t use a sprite)</li>
<li>Annoying to manage if something has to change across all images</li>
</ul>
<h2>What was learnt?</h2>
<p>Chrome can&#8217;t swap <abbr title="Scalable Vector Graphics">SVG</abbr> filters. This means that an element can&#8217;t have a <abbr title="Scalable Vector Graphics">SVG</abbr> filter applied and then have that filter change on hover. IE9 can&#8217;t do much of this which was expected, but what I didn&#8217;t expect was for Safari to be almost as bad at it.</p>
<h2>Anything else?</h2>
<ul>
<li>You could blur the images via the HTML5 canvas, but that&#8217;s another article.</li>
<li>I don&#8217;t really mention Safari in this article &#8211; Most of this doesn&#8217;t seem to work in Safari 5.0.1 for Windows.</li>
<li>The CSS filters are going to be very cool</li>
</ul>
<h2>Article influences</h2>
<p>Paul Irish helped me look in the right direction &#8211; There is a surprisingly little amount of information about this topic out there.</p>
<blockquote class="twitter-tweet" data-in-reply-to="176918533891035136"><p>@<a href="https://twitter.com/jamygolden">jamygolden</a> canary supports CSS filters <a title="https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html" href="https://t.co/vD34peBH">dvcs.w3.org/hg/FXTF/raw-fi&#8230;</a> certainly the shorthands. havent tried the others. you should!<br />
— Paul Irish &#9685;&#8255;&#9685; (@paul_irish) <a href="https://twitter.com/paul_irish/status/176928121675726849" data-datetime="2012-03-06T07:12:06+00:00">March 6, 2012</a></p></blockquote>
<p>Paul&#8217;s article <a href="http://paulirish.com/2010/svg-filters-on-html5-video/"><abbr title="Scalable Vector Graphics">SVG</abbr> filters on HTML5 video</a> was quite informative. <a href="http://paulirish.com/2010/high-res-browser-icons/">High Res Browser Icons</a> was a life saver and I now make use of <a href="http://css3please.com/">CSS3 Please</a> multiple times a day.</p>
<p>The IE &#8216;blur&#8217; method which was used originates from a <a href="http://www.useragentman.com/blog/2011/04/23/css-blurred-text-shadow-in-ie-part-i/">useragentman article</a>. Subsequently <a href="http://www.useragentman.com/">Zoltan Hawryluk&#8217;s</a> (the owner of the useragentman blog) added some really helpful comments in the comments area and helped achieve a really good looking text-blur effect for IE7+.</p>
]]></content:encoded>
			<wfw:commentRss>http://css-plus.com/2012/03/gaussian-blur/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>My Journey to the Perfect Text-Editor</title>
		<link>http://css-plus.com/2012/02/my-journey-to-the-perfect-text-editor/</link>
		<comments>http://css-plus.com/2012/02/my-journey-to-the-perfect-text-editor/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 15:39:40 +0000</pubDate>
		<dc:creator>cssplus-admin</dc:creator>
				<category><![CDATA[Article]]></category>

		<guid isPermaLink="false">http://css-plus.com/?p=1413</guid>
		<description><![CDATA[This article is about why I feel Sublime Text 2 is the best text editor ever and how/why I ended up using it. I&#8217;ve decided to write this because I seem to talk about this topic quite often and it &#8230; <a href="http://css-plus.com/2012/02/my-journey-to-the-perfect-text-editor/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This article is about why I feel Sublime Text 2 is the best text editor ever and how/why I ended up using it. I&#8217;ve decided to write this because I seem to talk about this topic quite often and it would be easier for me to reference someone to an article rather than explaining my rationale over and over again.<br />
<span id="more-1413"></span></p>
<h2>Dreamweaver<img class="alignright size-full wp-image-1430" title="Windows" src="http://css-plus.com/wp-content/uploads/2012/02/windows-logo.jpg" alt="Windows Logo" width="40" height="40" /><img class="alignright size-full wp-image-1431" title="OSx" src="http://css-plus.com/wp-content/uploads/2012/02/apple-logo.png" alt="Apple Logo" width="40" height="40" /><a href="http://www.adobe.com/products/dreamweaver.html"><img class="alignright size-full wp-image-1420" title="Dreamweaver" src="http://css-plus.com/wp-content/uploads/2012/02/dreamweaver.png" alt="Dreamweaver thumbnail" width="40" height="40" /></a></h2>
<p>I started using Dreamweaver&#8217;s design mode when I began web-development. I didn&#8217;t touch HTML. I started using some of the <abbr title="Dreamweaver">DW</abbr> javascript functionality which I thought was quite powerful at the time ( this was literally all done without looking at HTML ), but I was getting frustrated with the tabular layout &#8211; It felt like I was fighting it more than working with it. Changing the width of tabular layouts isn&#8217;t easy when you have multiple nested tables.</p>
<p>I started seeing all kinds of unbelievable tutorials and javascript plugins online. Things like dragging elements around as if they were windows in an operating system. I slowly started manipulating other people&#8217;s code within the <abbr title="Dreamweaver">DW</abbr> code view and eventually I was permanently using that view. I felt design mode was for newbies and tabular design was old-school and evil. It was at this time that I started following popular online blogs such as <a href="http://css-tricks.com/">CSS-Tricks</a> and <a href="http://davidwalsh.name/">David Walsh</a>, etc.</p>
<p>Dreamweaver features that stood out for me:</p>
<ul>
<li>I enjoyed the syntax highlighting colours</li>
<li>Wrap text in element functionality</li>
<li>tags closed automatically</li>
<li>Find/replace throughout open files</li>
</ul>
<p>Note: It took Dreamweaver 30 seconds to load up so I could take the screenshot. Core2Quad 2.3ghz with 3gb of ram.</p>
<h2>Notepad++<img class="alignright size-full wp-image-1430" title="Windows" src="http://css-plus.com/wp-content/uploads/2012/02/windows-logo.jpg" alt="Windows Logo" width="40" height="40" /><a href="http://notepad-plus-plus.org/"><img class="alignright size-full wp-image-1436" title="Notepad++" src="http://css-plus.com/wp-content/uploads/2012/02/notepad-plus-plus.png" alt="Notepad++ Logo" width="56" height="40" /></a></h2>
<p>I eventually moved over to Notepad++. I enjoyed how quick it was &#8211; Lightning quick compared to the bulky Dreamweaver. However it didn&#8217;t have most of the things I liked about Dreamweaver and it wasn&#8217;t nearly as aesthetically pleasing with regards to icon layout, icons, colours in general and the syntax highlighting. I actually found &#8211; and still do find &#8211; the toolbar of icons ( including print, copy/cut/paste, find, etc) very insulting. Eventually I was using Notepad++ without turning back to Dreamweaver for anything, but still I didn&#8217;t feel completely comfortable with it, something was missing.</p>
<p>Note: I probably didn&#8217;t use this editor to it&#8217;s full potential.</p>
<h2>E-TextEditor<img class="alignright size-full wp-image-1430" title="Windows" src="http://css-plus.com/wp-content/uploads/2012/02/windows-logo.jpg" alt="Windows Logo" width="40" height="40" /><a href="http://www.e-texteditor.com/"><img class="alignright size-full wp-image-1423" title="e-texteditor" src="http://css-plus.com/wp-content/uploads/2012/02/e-texteditor.jpg" alt="" width="40" height="40" /></a></h2>
<p>I began noticing how many people were talking about TextMate but I could not use it since it was/is a Mac specific application. After some googling I noticed there was a &#8216;Windows&#8217; version of TextMate called &#8216;E-TextEditor&#8217;.</p>
<p>I found the syntax highlighting very pleasing and it had almost everything I could want, including FTP built into the app &#8211; This felt much more simple to get going than the Dreamweaver FTP functionality. One thing it didn&#8217;t have was &#8216;Find/replace throughout open files&#8217;. This was something I had missed since Dreamweaver.</p>
<p>Without a doubt, this became my text-editor of choice.</p>
<h2>GEdit<img class="alignright size-full wp-image-1426" title="Linux" src="http://css-plus.com/wp-content/uploads/2012/02/linux-tux.jpg" alt="Linux Tux" width="40" height="40" /><a href="http://projects.gnome.org/gedit/"><img class="alignright size-full wp-image-1424" title="GEdit" src="http://css-plus.com/wp-content/uploads/2012/02/gedit.png" alt="GEdit Logo" width="100" height="50" /></a></h2>
<p>I was getting fed up with Windows for various reasons and I couldn&#8217;t afford a Mac, so Linux ( Ubuntu ) was my next logical step. GEdit was/is the default text editor for Ubuntu and I was surprised that the default text editor that was so &#8216;advaced&#8217; compared to other default OS text editors. This mainly included pleasing syntax highlighting and tabbed functionality. GEdit didn&#8217;t have the &#8216;Find/replace throughout open files&#8217; functionality and something about it didn&#8217;t feel great when using it for larger projects. As far as features went, it didn&#8217;t have too many that I was aware of. For small HTML/CSS/JS projects or tests it was perfect though.</p>
<h2>Scite<img class="alignright size-full wp-image-1426" title="Linux" src="http://css-plus.com/wp-content/uploads/2012/02/linux-tux.jpg" alt="Linux Tux" width="40" height="40" /><a href="http://www.scintilla.org/SciTE.html"><img class="alignright size-full wp-image-1427" title="Scite" src="http://css-plus.com/wp-content/uploads/2012/02/scite.png" alt="Scite Logo" width="40" height="40" /></a></h2>
<p>By default Scite has ( or my default installation at the time ) the line numbers disabled. This is/was highly annoying and on top of that, it wouldn&#8217;t &#8216;remember&#8217; my option to keep line numbers enabled. Small things like this can really get to me &#8211; I want to feel completely at ease, comfortable and happy with my tools.</p>
<p>I didn&#8217;t really like the icons and the general look and feel of the editor, however, it was definitely much more advanced and nicer to use than GEdit &#8211; with options like “Convert selection to lowercase” to regular expression searches. By this time I had decided Scite was the Linux text editor for me, however as much as I liked it I preferred E-TextEditor, but I had completely moved away from Windows &#8211; apart from my virtual machine with PhotoshopCS3 and IETester. It&#8217;s difficult using a text editor when I would have switched it for E-TextEditor or TextMate in a heartbeat.</p>
<h2>Coda<img class="alignright size-full wp-image-1431" title="OSx" src="http://css-plus.com/wp-content/uploads/2012/02/apple-logo.png" alt="Apple Logo" width="40" height="40" /><a href="http://panic.com/coda/"><img class="alignright size-full wp-image-1422" title="Coda" src="http://css-plus.com/wp-content/uploads/2012/02/coda.png" alt="Coda Logo" width="40" height="40" /></a></h2>
<p>I began using a Mac at work and it had Coda pre-installed. I had heard almost as much about Coda as I had about TextMate, mainly from Chris Coyier and a co-worker/friend. I enjoyed Coda &#8211; It had extremely simple and intuitive FTP support and was very nice to use. Coda had random nuggets I hadn&#8217;t seen in editors, like a wildcard character within searches. This could be achieved with regular expressions in other text editors, but the simple option was nice. The lack of functionality I was used to got to me. Coda was nice for larger PHP projects or smaller HTML projects.</p>
<h2>TextMate<img class="alignright size-full wp-image-1431" title="OSx" src="http://css-plus.com/wp-content/uploads/2012/02/apple-logo.png" alt="Apple Logo" width="40" height="40" /><a href="http://macromates.com/"><img class="alignright size-full wp-image-1429" title="TextMate" src="http://css-plus.com/wp-content/uploads/2012/02/textmate.jpg" alt="TextMate Logo" width="40" height="40" /></a></h2>
<p>I was really eager to try out TextMate. I had heard so much about it and E-TextEditor was based on it.</p>
<p>TextMate was very different from other editors &#8211; especially since I was new to OSx. It was pretty much just a window of text. All the options could be accessed via keyboard-shortcuts or by the options panel. It took me a couple of minutes to get used to it but I really loved it.</p>
<h2>Komodo Edit<img class="alignright size-full wp-image-1430" title="Windows" src="http://css-plus.com/wp-content/uploads/2012/02/windows-logo.jpg" alt="Windows Logo" width="40" height="40" /><img class="alignright size-full wp-image-1426" title="Linux" src="http://css-plus.com/wp-content/uploads/2012/02/linux-tux.jpg" alt="Linux Tux" width="40" height="40" /><img class="alignright size-full wp-image-1431" title="OSx" src="http://css-plus.com/wp-content/uploads/2012/02/apple-logo.png" alt="Apple Logo" width="40" height="40" /><a href="http://www.activestate.com/komodo-edit"><img class="alignright size-full wp-image-1425" title="Komodo Edit" src="http://css-plus.com/wp-content/uploads/2012/02/komodo-edit.png" alt="Komodo Edit Logo" width="40" height="40" /></a></h2>
<p>As much as I liked TextMate, I could never get completely used to it because at the time I was working on 2 operating systems &#8211; OSx ( work ) and Ubuntu ( home/dev ). I was also sure I would end up using Windows for some or other reason in future due to work or somewhere else I was forced to. This meant that I would be using a different text editor on each operating system. This made me feel uncomfortable and I didn&#8217;t want to learn to use something I&#8217;d end up not using. It felt like a waste of time investment. I definitely wanted to get used to an editor that worked across all platforms. I wanted a text editor I would use for the rest of my life.</p>
<p>My seeking continued until I had found KomodoEdit. It was great. It had a couple of things I wasn&#8217;t ecstatic about, but the fact that it was cross platform made me forget about those quickly. KomodoEdit was definitely a very powerful text editor. I was referred to the application by a hardcore PHP backend friend and that made me feel good since I felt that I could grow with the editor if I needed to.</p>
<p>KomodoEdit is a light-weight and free version of KomodoIDE. I had found pretty much everything I had wanted.</p>
<ul>
<li>Light-weight &#8211; Check</li>
<li>Multiple language support &#8211; Check</li>
<li>Plenty of options &#8211; Check</li>
<li>Powerful &#8211; Check</li>
<li>Cross-Platform compatible &#8211; Check</li>
<li>Aesthetically pleasing &#8211; No</li>
<li>Find/replace throughout open tabs &#8211; No</li>
</ul>
<h2>Sublime Text 2<img class="alignright size-full wp-image-1430" title="Windows" src="http://css-plus.com/wp-content/uploads/2012/02/windows-logo.jpg" alt="Windows Logo" width="40" height="40" /><img class="alignright size-full wp-image-1426" title="Linux" src="http://css-plus.com/wp-content/uploads/2012/02/linux-tux.jpg" alt="Linux Tux" width="40" height="40" /><img class="alignright size-full wp-image-1431" title="OSx" src="http://css-plus.com/wp-content/uploads/2012/02/apple-logo.png" alt="Apple Logo" width="40" height="40" /><a href="http://www.sublimetext.com/2"><img src="http://css-plus.com/wp-content/uploads/2012/02/sublime-text-thumb-logo.png" alt="Sublime Text Logo" title="Sublime Text 2" width="40" height="40" class="alignright size-full wp-image-1460" /></a></h2>
<p>Finally I stumbled upon Sublime Text 2. And it was good.</p>
<p>It had everything I could ever want and more, this went from <a href="http://www.sublimetext.com/docs/2/multiple_selection_with_the_keyboard.html">Multi-select</a> to <a href="http://www.sublimetext.com/docs/2/distraction_free.html">distraction free mode</a>. It had all the above checks, it was aesthetically pleasing and had an unbelievable find functionality. The Mac text editors ( TextMate and Coda ) look and feel far better to use than applications on other operating systems &#8211; It&#8217;s like they&#8217;re just made better. SublimeText2 has kept this feeling, even on different operating systems. The fact that text editors had to look ugly in Linux and Windows had been something I had wondered about on and off for a long time &#8211; Finally there was one editor that broke my perception.</p>
<p>I had never used a dark theme before but the default SublimeText2 was perfect. It had Chrome styled tabs, you could record macros, create your own snippets very easily and it had a visual map of document on the side of the editor ( this seemed like it could get old quickly, but I find it very useful in spotting patterns in larger documents).</p>
<p>The options worked differently compared to any other application I had used before. An options page was a text page in a sort of object/array layout. At first I thought this was temporary and it would be updated in a future version, but I finally realized how brilliant it was. You could search for options via the text editor. Search results appear in another default text-editor tab and it&#8217;s all consistent. You don&#8217;t ever leave tabs and text, brilliant.</p>
<p>The best part is, it&#8217;s only a beta. That&#8217;s right, until the time of this writing <abbr title="Sublime Text 2">ST2</abbr> is a beta and it gets updated VERY often. New features, functionality and bug fixes come out with every update. <abbr title="Sublime Text 2">ST2</abbr> has always been expensive for a text-editor, atleast $59 is expensive for one to me, but <abbr title="Sublime Text 2">ST2</abbr> allows you to trial the software for as long as you&#8217;d like. On the site it says:</p>
<p>Sublime Text may be downloaded and evaluated for free, however a license must be purchased for continued use.</p>
<p>The license comes with a bunch of perks, the most noticable includes a per-user license, not per-install or per-machine. This means you can use the registered version on whatever operating system and machine you&#8217;re using. After running and using it on all operating systems I decided to purchase it and I would urge anyone who loves it half as much as I do to support the development.</p>
<p>On top of all of this, I&#8217;ve subsequently began to learn Ruby and it&#8217;s got a Ruby build system installed &#8211; along with a bunch of other builds, including ant build. <abbr title="Sublime Text 2">ST2</abbr> supports a vast amount of languages ( more than just syntax highlighting ), has plugin support and it supports Textmate snippets. The <a href="http://www.sublimetext.com/forum/">community </a>is also pretty great.</p>
<p>As you may possibly know, I develop HTML, CSS, Javascript, PHP and Ruby. I&#8217;ve got friends who I&#8217;ve convinced to permanently use <abbr title="Sublime Text 2">ST2</abbr> and they use languages ranging from Python to C++.</p>
<p>According to me, it is by far the best text-editor around.</p>
<h2>tldr;</h2>
<p>Sublime Text 2 is awesome.</p>
<h2>Disclaimer</h2>
<p>I don&#8217;t own any of the icons used, they belong to the text-editor/operating system.<br />
I may have unfairly moved on from some of the text editors due to lack of specific functionality (or perceived lack of), aesthetics and cross-OS support. I may have been a bit unfair and some of you may disagree with me, but for me <abbr title="Sublime Text 2">ST2</abbr> wins in every field. Also, if I&#8217;ve misrepresented any text-editor above, please correct me by with a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://css-plus.com/2012/02/my-journey-to-the-perfect-text-editor/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Bulletproof full page background images don&#8217;t exist</title>
		<link>http://css-plus.com/2012/01/bulletproof-full-page-background-images/</link>
		<comments>http://css-plus.com/2012/01/bulletproof-full-page-background-images/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 16:23:16 +0000</pubDate>
		<dc:creator>cssplus-admin</dc:creator>
				<category><![CDATA[Article]]></category>

		<guid isPermaLink="false">http://css-plus.com/?p=1393</guid>
		<description><![CDATA[They don&#8217;t and can&#8217;t exist. Before I continue, let me explain what a &#8216;bulletproof full page background&#8217; is. This is a solution that will always give the &#8216;perfect&#8217; full page background-image across multiple viewports regardless of which image you are &#8230; <a href="http://css-plus.com/2012/01/bulletproof-full-page-background-images/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>They <em>don&#8217;t</em> and <em>can&#8217;t exist</em>. Before I continue, let me explain what a &#8216;bulletproof full page background&#8217; is. This is a solution that will always give the &#8216;perfect&#8217; full page background-image across multiple viewports <strong>regardless of which image you are using</strong>.<br />
<strong>Note:</strong> I understand &#8216;perfect&#8217; is a very subjective term.<br />
<span id="more-1393"></span><br />
I have been asked to create a full page background image before; There was a problem, however&#8230; </p>
<p>Images can stretch nicely as long as the proportion remains constant, otherwise the image looks stretched. This is an example of what someone might consider a perfect full page background-image:<br />
<img src="http://css-plus.com/wp-content/uploads/2012/01/perfect-scale-1.png" alt="" title="perfect-scale-1" width="366" height="218" class="alignnone size-full wp-image-1394" /><br />
As you can see, the scale remains constant and this works with the perfect full page background-image.</p>
<h2>Problem 1</h2>
<p>The background in the previous example contains the width/height of the viewport. If the second viewport didn&#8217;t have the same dimension ratio, that very same background could look something like this:<br />
<img src="http://css-plus.com/wp-content/uploads/2012/01/scale-stretch-height.png" alt="" title="scale-stretch-height" width="466" height="197" class="alignnone size-full wp-image-1396" /><br />
That is clearly an example of a &#8216;failed&#8217; full page background. </p>
<h2>Problem 2</h2>
<p>A <em>typical and easy</em> way to fix it would be to set the background-image width to be equal to the viewport&#8217;s width, but <em>leave the height a dynamic size</em>. This would give you something that looks like this:<br />
<img src="http://css-plus.com/wp-content/uploads/2012/01/scale-cutoff.png" alt="" title="scale-cutoff" width="466" height="197" class="alignnone size-full wp-image-1395" /><br />
Obviously the problem here is that the entire bottom area of the image is currently not visible&#8230; Unless you scroll down, which defeats the purpose of a full-page background-image.</p>
<h2>Problem 3</h2>
<p>You could very well set the height to fit the viewport&#8217;s height and have a dynamic width. With this example, the output would now look something like this:<br />
<img src="http://css-plus.com/wp-content/uploads/2012/01/scale-cutoff-width.png" alt="" title="scale-cutoff-width" width="466" height="197" class="alignnone size-full wp-image-1400" /><br />
This seems like the perfect full page background image solution right? Well&#8230; Not really. If we used the exact same technique with an image that has a larger width than it does height, it would look like this:<br />
<img src="http://css-plus.com/wp-content/uploads/2012/01/scale-stretch-width.png" alt="" title="scale-stretch-width" width="466" height="197" class="alignnone size-full wp-image-1397" /></p>
<h2>So, what is the solution?</h2>
<p>The perfect solution exists, as long as you don&#8217;t feel that &#8216;perfect&#8217; implies every image should look great with the specific solution. As long as you have background images with similar layouts ( All have width &gt; height or visa versa ) you could use a solution to work with them all.</p>
<p>I have seen a static image used as a centered background image which worked well for that situation.<br />
<img src="http://css-plus.com/wp-content/uploads/2012/01/static-example.png" alt="" title="static-example" width="466" height="197" class="alignnone size-full wp-image-1398" /></p>
<h2>Conclusion</h2>
<p>When it comes to full page background images and dynamic backgrounds, make sure you understand how the dimensions work and pick the right solution for your needs.</p>
]]></content:encoded>
			<wfw:commentRss>http://css-plus.com/2012/01/bulletproof-full-page-background-images/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Use :pseudo-elements as list-style-image alternatives</title>
		<link>http://css-plus.com/2011/12/control-your-list-items/</link>
		<comments>http://css-plus.com/2011/12/control-your-list-items/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 16:25:17 +0000</pubDate>
		<dc:creator>cssplus-admin</dc:creator>
				<category><![CDATA[Article]]></category>

		<guid isPermaLink="false">http://css-plus.com/?p=1312</guid>
		<description><![CDATA[Styling lists with CSS can be a bit of a pain from time to time. If I require an kind of customized bullet, the first CSS property I think of is list-style: none;. I&#8217;ve tried on more than one occasion &#8230; <a href="http://css-plus.com/2011/12/control-your-list-items/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Styling lists with <abbr title="Cascading Style Sheets">CSS</abbr> can be a bit of a pain from time to time. If I require an kind of customized bullet, the first <abbr title="Cascading Style Sheets">CSS</abbr> property I think of is <code>list-style: none;</code>. I&#8217;ve tried on more than one occasion to use <code>list-style-image</code> but it&#8217;s given me nothing but trouble when attempting to position it. A popular alternative is to use the image as a <code>background-image</code> of the list item.<br />
<span id="more-1312"></span></p>
<pre><code class="language-css">li { background: url(images/bullet.png) no-repeat left top; list-style: none; }</code></pre>
<p>This gives us the ability to move the &#8216;<i>list-item</i>&#8216; around as we please without problems. Great solution! right?! No, there are three very annoying (however, small) problems with this method:</p>
<ul>
<li>You can&#8217;t effectively include the list item in a sprite, as you&#8217;d run into problems displaying areas of the sprite you wish to remain hidden.</li>
<li>An image obviously can&#8217;t work with ordered lists as the numbered <code>list-style-type</code> would require a different image for each list item. This is possible but not very effective as it would require a lot of images and it wouldn&#8217;t be ever-expanding &#8211; It would have static amount of numbered images.</li>
<li>Adds to HTTP requests &#8211; this is especially annoying if you&#8217;ve got a couple of different lists all using this method</li>
</ul>
<p>Those are my two problems I have with the <code>background-image</code>, but I have managed to find a way around it.</p>
<h2>Standard background-image method</h2>
<p>Before I get started on the way I usually do this, let me show you what I did before and what I think most people do.</p>
<h3>The <abbr title="Hypertext Markup Language">HTML</abbr> necessary</h3>
<pre><code class="language-html">&lt;ul class="first-example"&gt;
	&lt;li&gt;SEO&lt;/li&gt;
	&lt;li&gt;Content Management System&lt;/li&gt;
	&lt;li&gt;Social Network Integration&lt;/li&gt;
	&lt;li&gt;Another list item for emphasis&lt;/li&gt;
&lt;/ul&gt;</code></pre>
<h3>The <abbr title="Cascading Style Sheets">CSS</abbr> necessary</h3>
<pre><code class="language-css">.first-example li { background: url(../i/tick.png) no-repeat left 8px; }
.first-example li { border-bottom: 1px solid #eee; font-size: 14px; list-style: none; padding: 10px 0 10px 40px; }</code></pre>
<p>You can see what&#8217;s going on, no explanation needed. The only thing to note here is the list items contain a background image and that image is a single file separate from the sprite which adds to http requests.</p>
<h2>Make use of <b>pseudo elements</b></h2>
<p>Pseudo elements are our friends. They are that extra bit of gas in the tank. When everything looks dull and there is no easy way to do what it is you want to do, look towards pseudo elements.</p>
<p>We could use pseudo elements as the &#8216;bullets&#8217;. This would solve the problem of showing more sprite than we&#8217;d like since we can set the pseudo-element&#8217;s <code>width</code> and <code>height</code> and give it the sprite background.</p>
<h3>The HTML</h3>
<p>The HTML is exactly the same as the first example with. The only difference is the class selector used for us to target.</p>
<pre><code class="language-html">&lt;ul class="second-example"&gt;
	&lt;li&gt;SEO&lt;/li&gt;
	&lt;li&gt;Content Management System&lt;/li&gt;
	&lt;li&gt;Social Network Integration&lt;/li&gt;
	&lt;li&gt;Another list item for emphasis&lt;/li&gt;
&lt;/ul&gt;</code></pre>
<pre><code class="language-css">li { border-bottom: 1px solid #eee; font-size: 14px; list-style: none; padding: 10px 0 10px 40px; position: relative; }

ul.second-example li:before {
	content: '';
	background: url(../i/sprite.png) no-repeat left top;
	height: 20px;
	width: 20px;
	position: absolute;
	left: 0;
	top: 8px;
}

ul.second-example li:nth-child(2n):before {
	background-position: -21px 0;
}</code></pre>
<p>Why exactly are we giving every second example a different list item image? For two reasons:</p>
<ul>
<li>It gives me an excuse to use a sprite in this example</li>
<li>We&#8217;re just retro and hip like that</li>
</ul>
<p>Le&#8217;s see what would have happened if we gave the first example the sprite as the background.</p>
<h3>List item with the sprite as a background-image</h3>
<p><img src="http://css-plus.com/wp-content/uploads/2011/11/background-with-sprite.jpg" alt="List items with a sprite background image" title="background-with-sprite" width="270" height="150" class="alignleft size-full wp-image-1318" /></p>
<h3>List item with pseudo element using the sprite as a background image &#8211; Preferred method</h3>
<p><img src="http://css-plus.com/wp-content/uploads/2011/11/pseudo-element-with-sprite.jpg" alt="Pseudo elements acting as list item bullets" title="pseudo-element-with-sprite" width="270" height="150" class="alignleft size-full wp-image-1319" /></p>
<h2>Make use of <abbr title="Cascading Style Sheets">CSS</abbr> counters</h2>
<p><img src="http://css-plus.com/wp-content/uploads/2011/12/ordered-list-pseudo-elements.jpg" alt="" title="ordered-list-pseudo-elements" width="241" height="167" class="alignleft size-full wp-image-1337" />What exactly are <a href="https://developer.mozilla.org/en/CSS_Counters">CSS counters</a>? A <abbr title="Cascading Style Sheets">CSS</abbr> counter is a function that is accepted by the <code>content</code> property of a pseudo element. You can count whatever it is you like. The amount of <code>&lt;section&gt;</code> elements in an article, the amount of <code>&lt;h2&gt;</code> elements, etc. In this case we&#8217;re going to be counting the amount of <code>&lt;li&gt;</code> elements. This way we can dynamically give the :before/:after pseudo elements a numerical value which will help to number our list items. </p>
<p>The <a href="https://developer.mozilla.org/en/CSS_Counters">CSS counter</a> property is within the <a href="http://www.w3.org/TR/CSS2/generate.html#counters">CSS 2.1 spec</a>. So this means that it has support down to IE8. I understand that it won&#8217;t work in IE7 &amp; IE6, but I don&#8217;t really care too much &mdash; I&#8217;d probably just give them the default numerical <code>list-item-type</code>.</p>
<h3>Bring on the CSS</h3>
<p>Some of <abbr title="Cascading Style Sheets">CSS</abbr> following will be the same as the previous CSS, but that&#8217;s because the list is styled in a similar fashion.<br />
li { border-bottom: 1px solid #eee; font-size: 14px; list-style: none; padding: 10px 0 10px 40px; position: relative; }<br />
li:first-child { border-top: 1px solid #eee; }</p>
<p>ul.first-example li { content: &#8221;; background: url(../i/tick.png) no-repeat left 8px; }</p>
<pre><code class="language-javascipt">ol.third-example { counter-reset: li; }

ol.third-example li { position: relative; }

ol.third-example li:before {
	content: counter(li);
	counter-increment: li;
	background: #f692bb;
	color: #333;
	font: bold 14px/20px sans-serif;
	height: 20px;
	text-align: center;
	width: 20px;
	position: absolute;
	left: 0;
	top: 8px;
	-webkit-border-radius: 10px;
	   -moz-border-radius: 10px;
	        border-radius: 10px;
	-webkit-box-shadow: inset 0 0 5px #F0498D, 2px 2px 0 rgba(0,0,0,.15);
	   -moz-box-shadow: inset 0 0 5px #F0498D, 2px 2px 0 rgba(0,0,0,.15);
		box-shadow: inset 0 0 5px #F0498D, 2px 2px 0 rgba(0,0,0,.15);
}</code></pre>
<p>Before I continue, thanks <a href="http://twitter.com/paulirish">paulirish</a> and <a href="http://twitter.com/jon_neal">jon_neal</a> for <a href="http://css3please.com/">CSS3 Please</a> &#8211; Quite a helpful tool.</p>
<p>Note: the position relative on the list item is very necessary since you&#8217;ll be absolutely positioning the pseudo elements within each item.</p>
<p>To use the counter() function properly, 3 things need to ne done.</p>
<ul>
<li>The counter of the specific element needs to be reset &mdash; Or as I like to think of it, enabled</li>
<li>The counter-increment needs to be told what to count, and by how much. (the increment could be by 2, or 10, in this example we&#8217;re going to leave it on 1 by default)</li>
<li>The counter() function needs to be passed into the content property and then told what to count</li>
</ul>
<p>Ok so first thing to do is to add the <code>counter-reset</code> property to the parent/ancestor container of the item you wish to count. You then give the <code>counter-reset</code> value the element type of the element to count. If you&#8217;d like to count the amount of paragraphs in the article element, you could reset the counting by adding the following <abbr title="Cascading Style Sheets">CSS</abbr> to your document:</p>
<pre><code class="language-javascript">body { counter-reset: p; }
/* Or */
article { counter-reset: p; }</code></pre>
<p>It cascades, so any container will do.</p>
<p>You would then add the <code>counter-increment</code> property to the pseudo element, this tells the pseudo element which element to count and by how much.</p>
<pre><code class="language-css">li { counter-increment: li 5; }</code></pre>
<p>That example would count in increments of 5 starting on that value, so: 5, 10, 15, etc. If you leave that value out it defaults to 1.</p>
<p>Finally, you would then add the <code>counter()</code> function to the <code>content</code> property of the pseudo element. This literally tells the pseudo element to contain the incremented value. </p>
<h2>Conclusion</h2>
<p>I find this extremely useful and consider it one of my better <abbr title="Cascading Style Sheets">CSS</abbr> tricks.<br />
Browser support isn&#8217;t horrible, but not brilliant either &mdash; The inclusion of IE7 would make it brilliant. Never the less, it&#8217;s completely usable in every day scenarios since I use it fairly often and I give IE7 the deafult numbered styling.</p>
<p>To recap: <b>counter-reset</b>: element, <b>counter-increment</b>: element num, <b>content</b>: counter(element).</p>
<p>Note: I actually make use of the custom bullets via pseudo elements on my unordered list items within my current website design.</p>
]]></content:encoded>
			<wfw:commentRss>http://css-plus.com/2011/12/control-your-list-items/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>How to make the input placeholder more user friendly</title>
		<link>http://css-plus.com/2011/09/make-the-input-placeholder-user-friendly/</link>
		<comments>http://css-plus.com/2011/09/make-the-input-placeholder-user-friendly/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 14:15:03 +0000</pubDate>
		<dc:creator>cssplus-admin</dc:creator>
				<category><![CDATA[Downloads]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://css-plus.com/?p=1232</guid>
		<description><![CDATA[I&#8217;ve always loved placeholder text for input fields. Not too long ago the only way to achieve this would be to create a special javascript function that enabled the desired functionality, but now it magically comes pre-built into HTML5. Incase &#8230; <a href="http://css-plus.com/2011/09/make-the-input-placeholder-user-friendly/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always loved placeholder text for input fields. Not too long ago the only way to achieve this would be to create a special javascript function that enabled the desired functionality, but now it <strong>magically comes pre-built into <abbr title="Hypertext Markup Language 5">HTML5</abbr></strong>. Incase you&#8217;re wondering, placeholder text is the text within an input field that disappears once you click on it. It&#8217;s often used in place of a label.<span id="more-1232"></span></p>
<h2>How is it not user friendly? <span><a href="#h1-html"><abbr title="Too long, didn't read">tl;dr</abbr> &#8211; Take me to the tutorial already</a></span></h2>
<p>Placeholder text can be very helpful and can save a lot of page space while also being aesthetically pleasing. With this great feature, however, comes a problem: If the placeholder text is being used in place of a label, it can become very confusing when you focus on the field and the &#8216;label&#8217; disappears.</p>
<p>It&#8217;s important for users to know:</p>
<ul>
<li>What field they are currently on</li>
<li>What field they have filled in</li>
</ul>
<h3>Typical input placeholder problem</h3>
<figure><img src="http://css-plus.com/wp-content/uploads/2011/09/placeholder-problem.png" alt="Figure 1 - Standard input placeholder problem" title="Figure 1 - Standard input placeholder problem" width="365" height="30" class="alignnone size-full wp-image-1234" /><br />
<figcaption>Which input field am I on?</figcaption>
</figure>
<p>Based on the image above, it&#8217;s impossible to tell what the first/focused field is. It is relatively simple to deduce <em>it&#8217;s either</em> a &#8216;<em>username</em>&#8216; or &#8216;<em>email</em>&#8216; field. The only way to find out which field you&#8217;re on would be to remove all the text in the field and blur (lose focus). I have personally been caught by this dozens and dozens of times and I find it very annoying.</p>
<p>One method that websites, such as <a href="http://twitter.com" rel="external">Twitter</a>, have been adopting is to have the <em>placeholder text fade out slightly on focus</em>, but only disappear once the user inputs some text. This is arguably the way that the <abbr title="Hypertext Markup Language 5">HTML5</abbr> placeholder should work by default.</p>
<h3>An improved version</h3>
<p><img src="http://css-plus.com/wp-content/uploads/2011/09/twitter-placeholder.jpg" alt="Figure 2 - The Twitter input placeholder" title="Figure 2 - The Twitter input placeholder" width="385" height="375" class="alignleft size-full wp-image-1247" /></p>
<ol>
<li>Normal Placeholder text</li>
<li>Placeholder text fades out slightly on focus</li>
<li>The input field is unknown once text has been added</li>
<li>The title attribute is used to add information</li>
</ol>
<p>The method that the <strong>Twitter login system</strong> uses is a big step up from the problem in fig.1, however the <strong>same problem still exists</strong> once the user has added text. </p>
<p>The <strong>title attribute</strong> has been used here so a user can see the placeholder text by hovering over the input field which is a great addition. Unfortunately in general, I still don&#8217;t feel this is as very user friendly as it could be.</p>
<h2>The solution</h2>
<p>I would like all of the bonuses of both the placeholder method and the standard label method. I&#8217;ve decided there is one basic way to achieve this: Have either the <strong>label of the input field</strong> or an <em>appropriate icon</em> appear to the right of the field after the field has received focus.</p>
<p>So that&#8217;s it, in this tutorial I&#8217;m going to show you how you can make a form with placeholder text that is semantic, user-friendly and degrades gracefully for legacy browsers.</p>
<h2><a id="h1-html"></a>The HTML</h2>
<p>The following <abbr title="Hypertext Markup Language">HTML</abbr> is normal &lt;form&gt; markup. It&#8217;s what we do with the <abbr title="Cascading Style Sheets">CSS</abbr> that really matters.</p>
<pre><code class="language-html">&lt;form id="login"&gt;
    &lt;ul&gt;
        &lt;li&gt;
            &lt;input id="email" name="email" placeholder="Your Email" title="Your Email" type="email" required /&gt;
            &lt;label for="email"&gt;Your Email&lt;/label&gt;
        &lt;/li&gt;
        &lt;li&gt;
            &lt;input id="password" name="password" placeholder="Your Password" title="Your Password" type="password" required /&gt;
            &lt;label for="password"&gt;Your Password&lt;/label&gt;
        &lt;/li&gt;
        &lt;li&gt;
            &lt;input id="submit" name="submit" type="submit" value="Login"&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
&lt;/form&gt;</code></pre>
<h2>The CSS</h2>
<pre><code class="language-css">#login{font-size: 12px; margin: 0 auto; width: 700px;}
#login li{float: left; list-style: none; margin-left: 30px; position: relative;}
#login li:first-child{margin-left: 0;}

label{line-height: 40px; position: absolute; right: 120px; top: 0; bottom: 0;
    -moz-transition: 0.3s right ease;
    -ms-transition: 0.3s right ease;
    -o-transition: 0.3s right ease;
    -webkit-transition: 0.3s right ease;
    transition: 0.3s right ease;
 	z-index: 0}

input{color: transparent; font-size: 12px; height: 35px; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px;
    -moz-transition: 0.3s all ease;
    -ms-transition: 0.3s all ease;
    -o-transition: 0.3s all ease;
    -webkit-transition: 0.3s all ease;
    transition: 0.3s all ease;}

input[type="email"], input[type="password"]{border: 1px solid #ccc; height: 35px; padding: 0 10px; width: 240px; position: relative;
	-moz-box-shadow: inset 0 0 10px rgba(0,0,0,.06);
	-webkit-box-shadow: inset 0 0 10px rgba(0,0,0,.06);
	box-shadow: inset 0 0 10px rgba(0,0,0,.06);
	z-index: 2;}

input[type="email"]{color: rgba(47,130,194,.8);}
input[type="password"]{color: rgba(237,28,112,.8);}

/* Placeholder */
input[type="email"]:-moz-placeholder{color: rgba(47,130,194,.6);}
input[type="email"]:-ms-input-placeholder{color: rgba(47,130,194,.6);}
input[type="email"]::-webkit-input-placeholder{color: rgba(47,130,194,.6);}

input[type="password"]:-moz-placeholder{color: rgba(237,28,112,.6);}
input[type="password"]:-ms-input-placeholder{color: rgba(237,28,112,.6);}
input[type="password"]::-webkit-input-placeholder{color: rgba(237,28,112,.6);}

/* Label */
input[type="email"] + label{color: rgb(47,130,194);}
input[type="password"] + label{color: rgb(237,28,112);}

input:focus + label{right: 10px;}

input[type="email"]:focus, input[type="password"]:focus{background-color: rgba(255,255,255,.8);}

/* Submit */
input[type="submit"]{
	background-color: #333;
	background: -moz-linear-gradient(bottom, #333, #444);
	background: -ms-linear-gradient(bottom, #333, #444);
	background: -o-linear-gradient(bottom, #333, #444);
	background: -webkit-linear-gradient(bottom, #333, #444);
	background: linear-gradient(bottom, #333, #444);
	border: 1px solid #222; color: #fff; cursor: pointer; height: 35px; width: 110px;
}

input[type="submit"]:hover{color: #ff6937;text-shadow: 0 0 1px rgba(255,255,255,.2);}</code></pre>
<p>The <abbr title="Cascading Style Sheets">CSS</abbr> mostly consists of general styling, I&#8217;d say the most important two lines are:</p>
<pre><code class="language-css">input:focus + label{right: 10px;}
input[type="email"]:focus, input[type="password"]:focus{background-color: rgba(255,255,255,.8);}</code></pre>
<p>So the label is absolutely placed behind the input field. On focus the label moves to the right while the input&#8217;s background fades to a lower opacity. This gives the illusion of the label sliding right while fading in.</p>
<p>That&#8217;s pretty much all there is to it. I think it&#8217;s a neat little trick.</p>
<h2>Let&#8217;s give IE a bit of love</h2>
<p>As always, IE spoils the party, but as always <a href="http://www.modernizr.com/">Modernizr</a> is here to save the day. We can get the form to act almost identically (sans animations) on IE8 and functionally on IE 6 and 7. Firstly, make sure you&#8217;ve given either the &lt;html&gt; or the &lt;body&gt; tag IE specific styles. For example:</p>
<pre><code class="language-html">&lt;!doctype html&gt;
&lt;!--[if lt IE 7 ]&gt; &lt;html class="no-js ie6 ie" lang="en"&gt; &lt;![endif]--&gt;
&lt;!--[if IE 7 ]&gt;    &lt;html class="no-js ie7 ie" lang="en"&gt; &lt;![endif]--&gt;
&lt;!--[if IE 8 ]&gt;    &lt;html class="no-js ie8 ie" lang="en"&gt; &lt;![endif]--&gt;
&lt;!--[if (gte IE 9)|!(IE)]&gt;&lt;!--&gt; &lt;html class="no-js" lang="en"&gt; &lt;!--&lt;![endif]--&gt;
&lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;script src="../../../js/libs/modernizr-2.0.6-min.js"&gt;&lt;/script&gt;</code></pre>
<p>Also, notice I&#8217;ve included Modernizr. I make use of Modernizr on pretty much every project I work on. It allows me to feature detect with javascript and I can make some pretty cool fallbacks with that.</p>
<p>Once we&#8217;ve got that set up we can easily start fixing up IE.</p>
<h3>IE specific CSS</h3>
<pre><code class="language-css">.ie input{line-height: 35px;}
.ie input[type="email"]{color: #2F82C2;}
.ie input[type="password"]{color: #ED1C70;}
.ie label{right: 10px;}

.ie input[type="email"]:focus, .ie input[type="password"]:focus{
    background:transparent;
    -ms-filter:"progid:DXImageTransform.Microsoft.gradient(startColorstr=#80ffffff,endColorstr=#80ffffff)";
    zoom: 1;
}
.ie7 label, .ie6 label{display: none;}</code></pre>
<p>The <abbr title="Cascading Style Sheets">CSS</abbr> just makes things work in IE. Nothing special really. The weird -ms-filter is to add opacity to the background in IE.</p>
<h3>Placeholder functionality fallback &#8211; jQuery with Modernizr</h3>
<pre><code class="language-javascript">if(!Modernizr.input.placeholder) {
    $("input[placeholder]").each(function() {
        var placeholder = $(this).attr("placeholder");

        $(this).val(placeholder).focus(function() {
            if($(this).val() == placeholder) {
                $(this).val("")
            }
        }).blur(function() {
            if($(this).val() == "") {
                $(this).val(placeholder)
            }
        });
    });
}</code></pre>
<p>This little snippet does the following:</p>
<ol>
<li>Detects for the placeholder attribute support. If no support is found, it continues</li>
<li>It then looks for all input elements with the placeholder attribute</li>
<li>It then takes the placeholder value and puts that within the &#8216;value&#8217; attribute</li>
<li>When focus is given to the element the value is set to none</li>
<li>When blurred, if the value attribute isn&#8217;t nothing, it leaves the text alone</li>
<li>If the value attribute is nothing, it replaces it with the placeholder text again</li>
</ol>
<h2>Foreseeable problems</h2>
<blockquote><p>The user can&#8217;t see the text if the input is full of characters.</p></blockquote>
<p>True story, but the opacity of the label is so low that it doesn&#8217;t really interfere with the readability of the text itself. A way around this would be to add padding-right which covers the length of the label. The only downside to this would be the input field having to be very long.</p>
<p>In general I think this is fine, but if you&#8217;re very worried about this, I&#8217;d say add <code>padding-right</code> to the label and use icons instead of text. This will save a lot of space.</p>
<h2>Conclusion</h2>
<p>I think it&#8217;s a pretty solid technique that will leave your website visitors &mdash; or me at least &mdash; happier and less confused while logging in.</p>
]]></content:encoded>
			<wfw:commentRss>http://css-plus.com/2011/09/make-the-input-placeholder-user-friendly/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Master the jQuery for each loop</title>
		<link>http://css-plus.com/2011/09/master-the-jquery-for-each-loop/</link>
		<comments>http://css-plus.com/2011/09/master-the-jquery-for-each-loop/#comments</comments>
		<pubDate>Mon, 05 Sep 2011 07:00:01 +0000</pubDate>
		<dc:creator>cssplus-admin</dc:creator>
				<category><![CDATA[Article]]></category>
		<category><![CDATA[beginner]]></category>

		<guid isPermaLink="false">http://css-plus.com/?p=1172</guid>
		<description><![CDATA[The jQuery for each loop can be very powerful. It is used just like any other jQuery function such as .click(), .hover(), etc. and it accepts a callback. As you know, or have probably guessed, the jQuery for each function &#8230; <a href="http://css-plus.com/2011/09/master-the-jquery-for-each-loop/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p class="clearfix">The <strong>jQuery for each loop</strong> can be very powerful. It is used just like any other jQuery function such as <a href="#">.click()</a>, <a href="http://api.jquery.com/hover">.hover()</a>, etc. and it accepts a callback. As you know, or have probably guessed, the <em>jQuery</em> for each function <strong>loops over selected items</strong> and does whatever you&#8217;d like to targetted items.<span id="more-1172"></span></p>
<p>You may be asking yourself:</p>
<blockquote><p>But isn&#8217;t that what CSS or jQuery selectors do anyway? What&#8217;s the difference?</p></blockquote>
<h2>Standard jQuery for .each()</h2>
<p>Not only does the jQuery for each function loop over each selected element, it also keeps track of the element index within the loop. For example:<br />
<iframe class="jsfiddle" src="http://jsfiddle.net/jamygolden/JhpfD/embedded/"></iframe><br />
As you can see in the example, it&#8217;s some very basic HTML with some very basic CSS. The jQuery is also relatively simple, I&#8217;m pretty sure you would be able to guess what is going on even if I didn&#8217;t explain, but I will!</p>
<p>The above example is selecting all <code>&lt;li&gt;</code> elements and looping over them. It is then adding a class of &#8216;item-&#8217; with its index value appended to it. The index begins at 0.</p>
<p>The <code>$(this)</code> keyword references each iterated element. This is where .each() becomes very useful.</p>
<p>I feel that&#8217;s a pretty straight forward jQuery for each loop that you should be able to get the hang of pretty quickly if you&#8217;re fairly familiar with jQuery.</p>
<h2>The javascript for loop</h2>
<p>If you&#8217;re still pretty new to jQuery and you&#8217;re feeling adventurous, how about throwing in a javascript for loop instead of a jQuery for each loop? &#8216;Why&#8217; you ask? Well because it is <a href="http://jsperf.com/javascript-vs-jquery-foreach">much faster</a>.</p>
<p>While you won&#8217;t notice the difference on small scripts and pages, it could make a difference while looping through many items and even other loops. It&#8217;s also never a bad thing to learn some javascsript when you can.<br />
<iframe class="jsfiddle" src="http://jsfiddle.net/jamygolden/dvcaD/1/embedded/"></iframe><br />
Personally I prefer doing this. It certainly isn&#8217;t much more complicated than the jQuery version.</p>
<h2>Alright, how is <a href="http://api.jquery.com/jQuery.each/">$.each()</a> any different?</h2>
<p>If you didn&#8217;t already know, there is another jQuery for each function, but it&#8217;s not the same as the one we&#8217;ve already covered. The $.each() function loops over items in an array or items in an object. I didn&#8217;t run into arrays or objects until quite a while after I was comfortable with jQuery, so don&#8217;t feel left out if you don&#8217;t know what&#8217;s going on. I suggest having a look at the <a href="http://jqfundamentals.com/">jQuery fundamentals</a> page. It covers basic javascript and helps you use jQuery to it&#8217;s full potential.</p>
<p>Back to the point: how would we use $.each()? Without further a due, here&#8217;s an example!<br />
<iframe class="jsfiddle" style="width: 100%; height: 300px" src="http://jsfiddle.net/jamygolden/rrGmp/1/embedded/"></iframe><br />
In this example I&#8217;ve used an object instead of an array, but they both work pretty much the same way. First the object <code>obj</code> is declared with a couple of random  <code>key</code> and <code>value</code> values. It is then looped over using the jQuery function. As an example, I&#8217;ve appended the values to a div and also used the key as the class of each paragraph.</p>
<h2>Conclusion</h2>
<p>As you can see, there isn&#8217;t much to jQuery or javascript for each loops! Save time and make your life more simple by making use of them!</p>
]]></content:encoded>
			<wfw:commentRss>http://css-plus.com/2011/09/master-the-jquery-for-each-loop/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Create Accordions with CSS3, HTML5 and jQuery</title>
		<link>http://css-plus.com/2011/08/create-accordions-with-css3-html5-and-jquery/</link>
		<comments>http://css-plus.com/2011/08/create-accordions-with-css3-html5-and-jquery/#comments</comments>
		<pubDate>Mon, 22 Aug 2011 15:35:44 +0000</pubDate>
		<dc:creator>cssplus-admin</dc:creator>
				<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://css-plus.com/?p=1150</guid>
		<description><![CDATA[First thing is first, let me clarify what I mean by Create an Accordion with CSS3, HTML5 and jQuery. I am talking about creating 3 different accordions, one which relies heavily on CSS3, one with jQuery and one with HTML5. &#8230; <a href="http://css-plus.com/2011/08/create-accordions-with-css3-html5-and-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>First thing is first, let me clarify what I mean by <strong>Create an Accordion with CSS3, HTML5 and jQuery</strong>. I am talking about creating 3 <em>different</em> accordions, one which relies heavily on CSS3, one with jQuery and one with HTML5.</p>
<p>If you haven&#8217;t already had to create some sort of accordion by now, I&#8217;m sure you will run into it sooner or later. It&#8217;s actually a very simple concept that requires very little script to create a fully functional accordion.<br />
<span id="more-1150"></span><br />
Accordions are typically used to toggle extra information. They help to organize and de-clutter information. You could make use of an accordion to display:</p>
<ul>
<li>child pages in a menu</li>
<li>the answers to questions on a <abbrd title="Frequently asked questions">FAQ</abbr> page</li>
<li>WordPress makes heavy use of accordions in it&#8217;s admin-area.</li>
<li>Your imagination is the limit</li>
</ul>
<p>Whatever the use, it&#8217;s essential to have the ability to create any kind of accordion in your web-dev-brain-toolbox. </p>
<p>First, we&#8217;re going to create a basic accordion with <strong>jQuery</strong>, then an accordion with <strong>CSS3</strong> and finally an accordion with <strong>HTML5</strong>. The jQuery version will have excellent browser support while the CSS3 version will have less, and finally the HTML5 version will have the least browser support.</p>
<p>All right, let&#8217;s get started.</p>
<h2>HTML and basic CSS</h2>
<p>This is the basic HTML and CSS of the accordion we&#8217;ll be working with:</p>
<h3>HTML</h3>
<p>The layout is pretty basic.</p>
<pre><code class="language-html">&lt;div class="accordion"&gt;
	&lt;h2&gt;Aliquam tincidunt mauris eu risus&lt;/h2&gt;
	&lt;p&gt;lorem ipsum dolor....&lt;/p&gt;
	&lt;h2&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit&lt;/h2&gt;
	&lt;p&gt;lorem ipsum dolor....&lt;/h2&gt;
	&lt;h2&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit&lt;/h2&gt;
	&lt;div&gt;
		&lt;p&gt;lorem ipsum dolor....&lt;/p&gt;
		&lt;p&gt;lorem ipsum dolor....&lt;/p&gt;
	&lt;/div&gt;
&lt;/div&gt;</code></pre>
<p>The h2 will be the &#8220;button&#8221; for the accordion. The element that comes directly after that will be the element being toggled by clicking on the previous h2. Any element, meaning it could be an image, a paragraph, a div containing whatever you want. I feel that&#8217;s the most efficient way of creating this type of accordion.</p>
<h3>CSS</h3>
<pre><code class="language-css">.accordion{border: 1px solid #ddd; border-top: none; margin: 10px 0; width: 470px;}
#accordion &gt; a{display: block; text-decoration: none;}
#accordion &gt; h2, .accordion &gt; a{background-color: #fff; background-image: url(../img/gradient.jpg);
background-image: -moz-linear-gradient(bottom, #f1f1f1, #fff);
background-image: -ms-linear-gradient(bottom, #f1f1f1, #fff);
background-image: -o-linear-gradient(bottom, #f1f1f1, #fff);
background-image: -webkit-linear-gradient(bottom, #f1f1f1, #fff);
background-image: linear-gradient(bottom, #f1f1f1, #fff); border-top: 1px solid #ddd;
color: #222; font: 14px/30px 'Verdana', sans-serif; height: 30px; margin: 0; padding: 0; text-indent: 10px;}
p{color: #555; font: 12px/18px 'Verdana', sans-serif; padding: 20px 10px;}</code></pre>
<p>The CSS is just doing some basic styling. I&#8217;ve thrown in some CSS3 gradients with a fallback image because that&#8217;s how I roll.</p>
<h3>The jQuery</h3>
<p>It&#8217;s really amazing at how simple jQuery can make our lives. This is all that is required for the accordion:</p>
<pre><code class="language-javascript">$('h3.accordion').click(function(){
    $(this).next().slideToggle();
}).next().hide();</code></pre>
<p>Now if that&#8217;s not simple, I don&#8217;t know what is.</p>
<p>That&#8217;s it. You now have a fully functional jQuery accordion!</p>
<h2>The CSS3 version</h2>
<p>The CSS version has some slightly different HTML and 2 new CSS lines.</p>
<h3>The HTML becomes</h3>
<pre><code class="language-css">&lt;div class="accordion"&gt;
	&lt;a href="#accordion-1"&gt;Aliquam tincidunt mauris eu risus&lt;/a&gt;
	&lt;p id="accordion-1"&gt;lorem ipsum dolor....&lt;/p&gt;
	&lt;a href="#accordion-2"&gt;Lorem ipsum dolor sit amet, consectetuer adipiscing elit&lt;/h2&gt;
	&lt;p id="accordion-2"&gt;lorem ipsum dolor....&lt;/h2&gt;
	&lt;a href="#accordion-3"&gt;Aliquam tincidunt mauris eu risus&lt;/a&gt;
	&lt;div id="accordion-3"&gt;
		&lt;p&gt;lorem ipsum dolor....&lt;/p&gt;
		&lt;p&gt;lorem ipsum dolor....&lt;/p&gt;
	&lt;/div&gt;
&lt;/div&gt;</code></pre>
<p>There are 3 basic changes:</p>
<ul>
<li>The <code>&lt;h2&gt;</code>s have been turned in to anchor links</li>
<li>The hidden contents have been given an id</li>
<li>The anchor links have been given an <code>href</code> containing the id of the following element with an appended hash</li>
</ul>
<h3>The CSS</h3>
<p>The CSS is the same as before, but with the added lines:</p>
<pre><code class="language-css">a[href^="#accordion"] + *{display: none;}
#accordion :target{display: block;}</code></pre>
<p>Very basically, the CSS is doing this:</p>
<p>Target all <em>anchor links</em> that have an <code>href</code> that begins with &#8216;#accordion&#8217; and target whatever element comes <strong>directly</strong> after that.</p>
<p>As for the <code>#accordion :target</code> line, that&#8217;s saying whatever is target should just display block. Unfortunately we can&#8217;t use the transition property over here since we would have to define a set height. Transition doesn&#8217;t animate <code>display</code> or <code>height: auto</code> so the height can&#8217;t be dynamic &mdash; or maybe I just haven&#8217;t figured that out yet.</p>
<p>There is a con to using the CSS3 method: The anchor links cause the page to jump to the <code>:target</code> which is pretty annoying. There are two ways around this that I&#8217;ve come up with.</p>
<ul>
<li><code>return false</code> with javascript</li>
<li>Make sure the page height is too short to have a scrollbar &#8211; This will work, but I&#8217;m not serious about this one</li>
</ul>
<h3>The Javascript &#8211; Remove page jump</h3>
<pre><code class="language-javascript">$('#accordion a').click(function(){
	return false;
});</code></pre>
<p>Return false just tells the HTML not react with it&#8217;s normal behaviour.</p>
<h2>The HTML5 method</h2>
<p>I think this is the most semantic way of doing this and it has a pretty decent fallback (Same fallback as the jQuery version). If the sliding functionality isn&#8217;t 100% essential, this is a pretty cool way of doing it. Currently only webkit (Chrome and Safari) support this.</p>
<h3>The HTML</h3>
<pre><code class="language-html">&lt;div id="accordion-html5" class="accordion"&gt;
	&lt;details&gt;
	  &lt;summary&gt;&lt;h2&gt;Vestibulum auctor dapibus neque&lt;/h2&gt;&lt;/summary&gt;
	  &lt;p&gt;Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum.sis luctus, metus&lt;/p&gt;
	&lt;/details&gt;
	&lt;details&gt;
	  &lt;summary&gt;&lt;h2&gt;Vestibulum auctor dapibus neque&lt;/h2&gt;&lt;/summary&gt;
	  &lt;p&gt;Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum.sis luctus, metus&lt;/p&gt;
	&lt;/details&gt;
&lt;/div&gt;</code></pre>
<h3>The CSS</h3>
<p>By default the browser adds a little arrow next to &lt;summary&gt;. I didn&#8217;t want this so I&#8217;ve turned it off:</p>
<pre><code class="language-css">details summary::-webkit-details-marker{display: none;}</code></pre>
<h2>Conclusion</h2>
<p>The jQuery method is definitely the most cross-browser-friendly by far, but I think the HTML5 way may because used more and more as the browsers progress.<br />
Regardless of the CSS3 methods&#8217; cross-browser issues, it doesn&#8217;t really work well enough for us to use in production without the added bit of javascript so I think it&#8217;s best to use one of the other two methods.</p>
]]></content:encoded>
			<wfw:commentRss>http://css-plus.com/2011/08/create-accordions-with-css3-html5-and-jquery/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>jQuery if / else statements</title>
		<link>http://css-plus.com/2011/07/jquery-if-else-statements/</link>
		<comments>http://css-plus.com/2011/07/jquery-if-else-statements/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 16:45:33 +0000</pubDate>
		<dc:creator>cssplus-admin</dc:creator>
				<category><![CDATA[Article]]></category>

		<guid isPermaLink="false">http://css-plus.com/?p=240</guid>
		<description><![CDATA[There is no such thing as a jQuery if / else statement. Shocking, isn&#8217;t it? You might be thinking something like: &#8220;There must be! In fact, I&#8217;m 99% sure there is!&#8220;. They don&#8217;t exist. This is because jQuery is javascript. &#8230; <a href="http://css-plus.com/2011/07/jquery-if-else-statements/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There is <strong>no such thing as a jQuery if / else statement</strong>. Shocking, isn&#8217;t it? You might be thinking something like: &#8220;<em>There must be! In fact, I&#8217;m 99% sure there is!</em>&#8220;.</p>
<p>They don&#8217;t exist. This is because <em>jQuery is javascript</em>. What you&#8217;re looking for is a <em>javascript if/else statement</em>.<br />
<span id="more-240"></span></p>
<h2>Why I decided to write about jQuery if</h2>
<p>This article exists because when I started out with jQuery, I looked <em>everywhere</em> for a &#8216;<strong>jQuery if / else statement</strong>&#8216;. It blew my mind that something as important as an if statement didn&#8217;t exist on the web. It took me a while to realize that I couldn&#8217;t find it because I was looking in the wrong place. It was because of this <del>giant journey</del> <ins>problem</ins> I decided to write an article for anyone following a similar path.</p>
<h2>looking for useful jQuery tutorials?</h2>
<p>Before I go on, if you&#8217;re looking for some pretty useful jQuery tutorials, have a look at</p>
<ul>
<li><a href="http://css-plus.com/2010/03/fading-navigation-menu/">How to create a jQuery Fading Navigation Menu</a></li>
<li><a href="http://css-plus.com/2010/04/how-to-create-a-fading-border-gallery-with-opacity-focus/">How to create a jQuery Fading Border gallery with Opacity Focus</a></li>
<li><a href="http://css-plus.com/2010/09/create-your-own-jquery-image-slider/">How to create your own jQuery image slider</a></li>
</ul>
<h2>What is jQuery?</h2>
<p>jQuery is a one of many javascript libraries. Very simply, these libraries are shortcuts created by <a href="http://ejohn.org/">people with crazy javascript skills</a> for people like you and I. You could look at these libraries as one giant javascript plugin which make writing javascript 100 times more simple.</p>
<p>jQuery syntax <em>is</em> javascript, and therefore a lot of the things you do in jQuery are pretty much the same in plain ol&#8217; javascript. &#8216;<strong>jQuery if</strong> statements&#8217; are written the same way as javascript if statements, since it IS javascript.</p>
<h2>The basic syntax</h2>
<pre><code class="language-javascript">if(condition) {
	// code to be executed if condition is true
}
else {
	// code to be executed if condition is false
}</code></pre>
<p>The javascript (jQuery) if / else statement is almost identical to the PHP if / else statement.</p>
<pre><code class="language-php">$a = 5;
$b = 10;

if($a &gt; $b) {
	echo "&lt;p&gt;A is larger than B&lt;/p&gt;";
}
elseif($a == $b) {
	echo "&lt;p&gt;A is equal to B&lt;/p&gt;";
}
else {
	echo "&lt;p&gt;B is larger than A&lt;/p&gt;";
}</code></pre>
<p>And the javascript(jQuery) if / else version is:</p>
<pre><code class="language-javascript">var	a = 5,
	b = 10;

if(a &gt; b) {
	$("body").html("&lt;p&gt;A is larger than B&lt;/p&gt;");
}
else if(a == b) {
	$("body").html("&lt;p&gt;A is equal to B&lt;/p&gt;");
}
else {
	$("body").html("&lt;p&gt;B is larger than A&lt;/p&gt;");
}</code></pre>
<p>Note: The jQuery function html() is not equal to echo.</p>
<h2>Explanation of another example if statement</h2>
<h3>HTML</h3>
<pre><code class="language-html">&lt;div id="example"&gt;
	&lt;div&gt;&lt;/div&gt;
	&lt;div&gt;&lt;/div&gt;
&lt;/div&gt;</code></pre>
<h3>jQuery/javascript</h3>
<pre><code class="language-javascript">$(document).ready(function(){ 

	var n = $("#example div").length;

	if (n &lt; 2) {
		$("body").css("background", "green");
	}
	else {
		$("body").css("background", "orange");
	}

});</code></pre>
<p>Very basically the above is saying: Count the amount of div&#8217;s within the ID #example, and if it is less than 2, change the body&#8217;s background colour to green, otherwise change the background colour to orange.</p>
<p>What do you think the outcome would be?</p>
<p>If you guessed orange&#8230; Then you would be right. </p>
<h2>Javascript shorthand if statement</h2>
<p>As <a href="http://www.bar-design.co.za/">Stefan</a> has commented and pointed out to me, there is a shorthand javascript if statement which we could use instead of the above:</p>
<pre><code class="language-javascript">var n = $("#example div").length;
$("body").css("background", (n &lt; 2) ? "green" : "orange");</code></pre>
<p>Now that is pretty handy! Creating a javascript if statement couldn&#8217;t be more simple.</p>
<h2>Conclusion</h2>
<p>What is a &#8216;jQuery if statement&#8217;? &#8211; It is a &#8216;javascript if statement&#8217; that happens to contain some jQuery.</p>
]]></content:encoded>
			<wfw:commentRss>http://css-plus.com/2011/07/jquery-if-else-statements/feed/</wfw:commentRss>
		<slash:comments>56</slash:comments>
		</item>
		<item>
		<title>Behold the CSS Lightsaber</title>
		<link>http://css-plus.com/2011/06/behold-the-css-lightsaber/</link>
		<comments>http://css-plus.com/2011/06/behold-the-css-lightsaber/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 16:35:02 +0000</pubDate>
		<dc:creator>cssplus-admin</dc:creator>
				<category><![CDATA[Article]]></category>

		<guid isPermaLink="false">http://css-plus.com/?p=1106</guid>
		<description><![CDATA[Note: Check out the demo before reading. I&#8217;ve been working on CSS lightsabers lately. I remember seeing one a while back and liking the concept, however I thought it could be greatly improved. I&#8217;ve also been itching to create animation &#8230; <a href="http://css-plus.com/2011/06/behold-the-css-lightsaber/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Note: <a href="http://css-plus.com/examples/2011/06/css-lightsabers/">Check out the demo</a> before reading. I&#8217;ve been working on <strong>CSS lightsabers</strong> lately. I remember seeing <a href="http://www.thedesigngnome.com/2010/06/how-to-build-a-lightsaber-with-css/">one</a> a while back and liking the concept, however I thought it could be greatly improved. I&#8217;ve also been itching to create <strong>animation out of CSS transitions</strong>. By &#8220;animation&#8221; I mean one event followed by another event. Transitions can mimic full blown animation by transitioning multiple elements at the same time with different delays. This gives the effect of an element being animated. Very simply they all occur simultaneously, but the initial delay make the events appear to follow each other.<br />
<span id="more-1106"></span><br />
The sabers were both very carefully crafted with CSS alone. With Yoda&#8217;s saber I focused on having different options. <em>Switch on</em>, <em>increase power</em> and <em>increase length</em>. It was a bit of a work around to get the options to work with each other since only one transition can occur on an element at any given time. This would mean that in order to keep the Saber on, decrease power and decrease length is == to power up.</p>
<p>I&#8217;m pretty sure people will mention that some of this could be done with the CSS keyframe animations. Yes, it can and should, however, I started this a couple of weeks back (Firefox5 was only released yesterday with support for the CSS property) and I don&#8217;t really like working in Webkit.</p>
<h2>Firefox loves lightsabers</h2>
<p>This demo looks best in Firefox by far. Everything is rendered absolutely perfectly. In other browsers? Not so much.</p>
<h3>Chrome</h3>
<p>The demo doesn&#8217;t work as it should in Chrome and there were two main problems with this demo. The <code>transition</code> can be applied to pseudo elements. I started of animating pseudo elements all over the place, but I stopped because I wanted Webkit to at least partially support the demo. Also, Webkit doesn&#8217;t seem to handle transitions very well yet. Have a look yourself. Go to the demo: Click on &#8220;Higher&#8221;, then on &#8220;Longer&#8221;. It refuses to do the transition. It seems like Webkit has a problem when going from one transition into another. In order to get it to work you have to use a transition, clear it and then fire off another transition. In comparison to Firefox, the shadows look a bit&#8230; Hard.</p>
<h3>Opera</h3>
<p>Opera has a different set of issues. It animates (along with a few rendering bugs here and there) from transition to transition, however, a transition on the <code>box-shadow</code> property doesn&#8217;t seem to take.</p>
<h3>IE10</h3>
<p>I haven&#8217;t tested this yet. If you have IE10 and you test it, let me know what the problems were.</p>
<h2>That&#8217;s about it</h2>
<p>This took me a fair amount of time to complete and iron out the major bugs. Let me know if you have any questions and what you think.</p>
]]></content:encoded>
			<wfw:commentRss>http://css-plus.com/2011/06/behold-the-css-lightsaber/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>CSS-Plus V2</title>
		<link>http://css-plus.com/2011/06/css-plus-v2/</link>
		<comments>http://css-plus.com/2011/06/css-plus-v2/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 18:32:42 +0000</pubDate>
		<dc:creator>cssplus-admin</dc:creator>
				<category><![CDATA[Article]]></category>

		<guid isPermaLink="false">http://css-plus.com/?p=1018</guid>
		<description><![CDATA[If you haven&#8217;t noticed the new design, you&#8217;re either new to CSS-Plus or you have hit ctrl / cmd + r in a while. I&#8217;ve been talking about a redesign for longer than I&#8217;d like but it&#8217;s finally here, however &#8230; <a href="http://css-plus.com/2011/06/css-plus-v2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you haven&#8217;t noticed the new design, you&#8217;re either new to CSS-Plus or you have hit <kbd>ctrl / cmd + r</kbd> in a while. I&#8217;ve been talking about a redesign for longer than I&#8217;d like but it&#8217;s finally here, however it&#8217;s not 100% complete yet. You may notice that things look a little funky here and there, but don&#8217;t worry, I&#8217;m working on it! It should be complete within this week.<br />
<span id="more-1018"></span></p>
<h2>What&#8217;s new?</h2>
<p>In general the font is larger, the headings are larger, the website is fluid (Or will be once I&#8217;m done). My main objective was the make the the website easier to read, easier to navigate and more enjoyable to be on.</p>
<h3>Colour palette</h3>
<p>I&#8217;ve decided to go largely with the blue and pink. The colour palette consists of 5 colours: Orange, pink, light-blue, navy blue and grey. I&#8217;ve decided to go with a very light template compared to the previous one. I feel it&#8217;s much easier to read and more enjoyable to be on a lighter website. Darker colour palettes can work, but I don&#8217;t feel they really work on blogs.</p>
<h3>The logo</h3>
<p><img src="http://css-plus.com/wp-content/uploads/2011/06/plus-logo.png" alt="CSS-Plus Logo" title="plus-logo" width="59" height="48" class="alignright size-full wp-image-1032" />After messing around with many types of logos, I noticed that the &#8216;P&#8217; in CSS-Plus could contain a plus symbol if I were to extend it a bit. I think it looks pretty cool. Other than that, the font used was &#8216;<a href="http://www.google.com/webfonts/family?family=Cantarell&#038;subset=latin">Cantarell</a>&#8216;.</p>
<h3>Where did the tags go?</h3>
<p>The tags are still there, I&#8217;ve just removed all links to them. Ultimately I&#8217;m going to remove them completely because I don&#8217;t really think they serve a real purpose. The analytics agreed with me.</p>
<h3>Navigation and Sidebar</h3>
<p>I&#8217;ve realized that it&#8217;s been a bit tough to navigate the site easily.</p>
<p>The sidebar now includes most popular articles, the latest articles and my latest plugins &mdash; I plan on making a handful of very useful jQuery plugins.</p>
<h3>Search here&#8230;</h3>
<p>I&#8217;ve always had a search bar but it was barely used. Also, the results page was pretty nasty&#8230; Perhaps that&#8217;s the reason it wasn&#8217;t used all that much? Anyway, I&#8217;ve implemented the new GSE code and the results are much easier on the eye.</p>
<h3>Article Thumbnails</h3>
<p>I&#8217;ve started using the WordPress thumbnail feature. I think it makes everything much more interesting to look at. At largest they are 180&#215;180 images with a border, drop shadow and inner shadow. The more CSS I used, the more control I have over everything.</p>
<h3>Pretty comments</h3>
<p>I quite like the new comments. I&#8217;ve made them much more orderly, easier and more enjoyable to read.</p>
<h3>The footer</h3>
<p>The footer is largely the same. I&#8217;ve replaced the latest tweet area with my delicious links. I think they are much more useful than what I&#8217;ve said last on twitter.</p>
<h3>Social</h3>
<p>The latest additions to the social family has been the Google +1 button and a link to my Github account. Why +1? Because I think Google is absolutely awesome.</p>
<h2>Images and javasript has been avoided</h2>
<p>I haven&#8217;t avoided images as <em>much</em> as possible, but I have tended towards avoiding them. They aren&#8217;t necessary (Excluding fallback images) and it&#8217;s fun making everything as semantic as possible. As for javascript, it&#8217;s overkill for something that CSS can easily and semantically do, such as the hover effect in the footer.</p>
<h2>Suggestions?</h2>
<p>Let me know if you have any suggestions.</p>
]]></content:encoded>
			<wfw:commentRss>http://css-plus.com/2011/06/css-plus-v2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 4/14 queries in 0.066 seconds using disk: basic

Served from: css-plus.com @ 2012-05-18 16:01:31 -->
