<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0">

<channel>
	<title>Joshua Hibbert</title>
	
	<link>http://joshnh.com</link>
	<description>Web Designer</description>
	<lastBuildDate>Thu, 04 Apr 2013 00:17:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/joshnh" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="joshnh" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Position: Relative; What is It Good For?</title>
		<link>http://joshnh.com/2012/12/14/position-relative-what-is-it-good-for/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=position-relative-what-is-it-good-for</link>
		<comments>http://joshnh.com/2012/12/14/position-relative-what-is-it-good-for/#comments</comments>
		<pubDate>Fri, 14 Dec 2012 07:39:26 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://joshnh.com/?p=1370</guid>
		<description><![CDATA[<p>There are four potential values for the position property (ignoring inherit) which are static, relative, absolute, and fixed. Now, while this article will be focusing on the relative value, it is important to understand some key bits of information about the other values: Static positioning (the default value) is actually a lack of positioning. Absolute...  <a href="http://joshnh.com/2012/12/14/position-relative-what-is-it-good-for/" title="Read Position: Relative; What is It Good For?">Read more &#187;</a></p><p>The post <a href="http://joshnh.com/2012/12/14/position-relative-what-is-it-good-for/">Position: Relative; What is It Good For?</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://joshnh.com/wp-content/uploads/2012/12/Position-Relative-What-is-It-Good-For.png" alt="Position- Relative; What is It Good For?"><span id="more-1370"></span></p>
<p>There are four potential values for the <code>position</code> property (ignoring <code>inherit</code>) which are <code>static</code>, <code>relative</code>, <code>absolute</code>, and <code>fixed</code>. Now, while this article will be focusing on the <code>relative</code> value, it is important to understand some key bits of information about the other values:</p>
<ul>
<li>Static positioning (the default value) is actually a lack of positioning.</li>
<li>Absolute or fixed positioning removes the element from the flow of the document.</li>
<li>Absolutely positioned elements are positioned relative to nearest positioned ancestor element.</li>
</ul>
<p>Right, now that you have wrapped your head around that, let’s talk about the uses for relative positioning. There are three main instances where it comes in handy:</p>
<ol>
<li>When you want to move an element (while keeping it in the flow of the document, but without disturbing any other elements).</li>
<li>When you want to define a containing box for absolutely positioned descendant elements.</li>
<li>When you need an element to have positioning so that you can use <code>z-index</code>.</li>
</ol>
<h2>Moving an element</h2>
<p>Elements are naturally rendered in the flow of the document, and as such, they interact (i.e. they affect the position of each other). This is generally a good thing, as most of the elements on your page have a <em>relationship</em> with the elements around them. For instance, a footer being pushed down by your main content.</p>
<p>Sometimes though, you want to move an element without it affecting any of the elements around it. This is where <code>position: relative;</code> comes in handy. When using relative positioning with the <code>top</code>, <code>right</code>, <code>bottom</code>, or <code>left</code> properties, it is only the generated box that is actually shifted; the element still remains where it was in the flow of the document. Keep in mind that this can often result in overlapping elements.</p>
<p>Also, it is important to remember that the <code>top</code>, <code>right</code>, <code>bottom</code>, and <code>left</code> properties can’t change the size of a relatively positioned element (they can if the element is absolutely positioned).</p>
<h2>Containing absolute descendants</h2>
<p>When positioning an element absolutely—as it is removed from the flow of the document—the <code>top</code>, <code>right</code>, <code>bottom</code>, and <code>left</code> properties don’t act as they would on a relatively positioned element. These properties are now based on the nearest positioned ancestor (or the root element, if there are none). This means that if you are giving an element a position of absolute and you want to confine it to a certain ancestor, setting <code>position: relative;</code> on that ancestor will do the trick without affecting the flow of that element.</p>
<p><img src="http://joshnh.com/wp-content/uploads/2012/12/Position-Relative-What-is-It-Good-For-image-2.png" alt="How relative positioning sets a context for absolute descendants"></p>
<p>The terminology is a little tricky here as an element with <code>position: static;</code> appears as though it has a position set, but as static positioning is in fact no positioning at all, static elements can’t be containing boxes for absolute elements.</p>
<h2>Using z-index</h2>
<p>Lastly, <code>z-index</code> is only respected on elements that have a position set. So if you don’t want to remove an element from the flow of the document, but want to use <code>z-index</code>, relative positioning is your friend.</p>
 <img src="http://joshnh.com/?feed-stats-post-id=1370" width="1" height="1" style="display: none;" /><p>The post <a href="http://joshnh.com/2012/12/14/position-relative-what-is-it-good-for/">Position: Relative; What is It Good For?</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://joshnh.com/2012/12/14/position-relative-what-is-it-good-for/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Here’s a Neat Trick Using the :Focus Pseudo-Class</title>
		<link>http://joshnh.com/2012/12/03/heres-a-neat-trick-using-the-focus-pseudo-class/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=heres-a-neat-trick-using-the-focus-pseudo-class</link>
		<comments>http://joshnh.com/2012/12/03/heres-a-neat-trick-using-the-focus-pseudo-class/#comments</comments>
		<pubDate>Mon, 03 Dec 2012 07:06:05 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://joshnh.com/?p=1328</guid>
		<description><![CDATA[<p>Demo I love to play around with CSS. So much so that if I have a spare five minutes, I will often open up CodePen and experiment. Doing exactly this the other day, I discovered a couple of things. The first of which was a neat interaction using the :focus pseudo-class, and the second being...  <a href="http://joshnh.com/2012/12/03/heres-a-neat-trick-using-the-focus-pseudo-class/" title="Read Here’s a Neat Trick Using the :Focus Pseudo-Class">Read more &#187;</a></p><p>The post <a href="http://joshnh.com/2012/12/03/heres-a-neat-trick-using-the-focus-pseudo-class/">Here’s a Neat Trick Using the :Focus Pseudo-Class</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://joshnh.com/wp-content/uploads/2012/12/Heres-a-Neat-Trick-Using-the-Focus-Pseudo-Class.png" alt="Here&#039;s a Neat Trick Using the Focus Pseudo-Class"><span id="more-1328"></span></p>
<p><a class="download" href="http://codepen.io/joshnh/pen/eIksb">Demo</a></p>
<p>I love to play around with CSS. So much so that if I have a spare five minutes, I will often open up <a href="http://codepen.io/">CodePen</a> and experiment. Doing exactly this the other day, I discovered a couple of things. The first of which was a neat interaction using the <code>:focus</code> pseudo-class, and the second being a line-height issue when working with inputs. You can read about that <a href="http://joshnh.com/2012/12/03/line-height-doesnt-work-as-expected-on-inputs/">here</a>.</p>
<h2>The fun bit</h2>
<p>What I’m doing in the demo is something very similar to the <a href="http://css-tricks.com/the-checkbox-hack">checkbox hack</a>, except instead of using the <code>:checked</code> pseudo-class, I’m using the <code>:focus</code> pseudo-class. This is pretty handy, as <code>:focus</code> has better browser support than <code>:checked</code>.</p>
<p>Using the following markup, I pair the label and input (i.e. clicking the label focuses the input):</p>
<p><pre>&lt;input id=&quot;search&quot; type=&quot;search&quot;&gt;
&lt;label for=&quot;search&quot;&gt;Search&lt;/label&gt;</pre></p>
<p>I then set the width of the input to 0, and increase it again on focus. For example:</p>
<p><pre>input:focus {
    width: 18em;
}</pre></p>
<p>I take the styling a little further in the demo to give a nice ‘slide to reveal’ effect.</p>
<h2>Be sensible</h2>
<p>As with anything, use this trick appropriately. There is a fair bit you could use it for, <a href="http://codepen.io/joshnh/pen/yzkfi">modal images</a> for instance, but just because you can, doesn’t mean you should!</p>
 <img src="http://joshnh.com/?feed-stats-post-id=1328" width="1" height="1" style="display: none;" /><p>The post <a href="http://joshnh.com/2012/12/03/heres-a-neat-trick-using-the-focus-pseudo-class/">Here’s a Neat Trick Using the :Focus Pseudo-Class</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://joshnh.com/2012/12/03/heres-a-neat-trick-using-the-focus-pseudo-class/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Line-Height Doesn’t Work As Expected On Inputs</title>
		<link>http://joshnh.com/2012/12/03/line-height-doesnt-work-as-expected-on-inputs/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=line-height-doesnt-work-as-expected-on-inputs</link>
		<comments>http://joshnh.com/2012/12/03/line-height-doesnt-work-as-expected-on-inputs/#comments</comments>
		<pubDate>Mon, 03 Dec 2012 07:00:06 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://joshnh.com/?p=1297</guid>
		<description><![CDATA[<p>While Chrome and Safari respect line-height values on inputs, Firefox, Internet Explorer, and Opera do not. I found out about this when experimenting with this little :focus trick I recently discovered. So why don’t all browsers behave the same way? Inconsistent behavior like this is very frustrating for a web designer. Ideally, I’d like all...  <a href="http://joshnh.com/2012/12/03/line-height-doesnt-work-as-expected-on-inputs/" title="Read Line-Height Doesn’t Work As Expected On Inputs">Read more &#187;</a></p><p>The post <a href="http://joshnh.com/2012/12/03/line-height-doesnt-work-as-expected-on-inputs/">Line-Height Doesn’t Work As Expected On Inputs</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://joshnh.com/wp-content/uploads/2012/12/Line-Height-Doesnt-Work-As-Expected-On-Inputs.png" alt="Line-Height Doesn&#039;t Work As Expected On Inputs"><span id="more-1297"></span></p>
<p>While Chrome and Safari respect <code>line-height</code> values on inputs, Firefox, Internet Explorer, and Opera do not. I found out about this when experimenting with <a href="http://joshnh.com/2012/12/03/heres-a-neat-trick-using-the-focus-pseudo-class/">this</a> little <code>:focus</code> trick I recently discovered.</p>
<p>So why don’t all browsers behave the same way? Inconsistent behavior like this is very frustrating for a web designer. Ideally, I’d like all browsers to behave as Chrome and Safari do in this case and respect <code>line-height</code> values on inputs. Unfortunately, this is not the case, although at least Firefox explicitly state what they will be doing in their user agent style sheet:</p>
<p><pre>input {
    line-height: normal !important;
}</pre></p>
<p>Who has the time to look through each browser’s user agent style sheet though? Also, using the value ‘normal’ is unreliable as that depends on the typeface and can roughly range from 1 to 1.2. Each browser also renders ‘normal’ slightly differently. See <a href="http://meyerweb.com/eric/thoughts/2008/05/06/line-height-abnormal/">this article</a> by Eric Meyer for more information.</p>
<p>Now I assume that Firefox, Internet Explorer, and Opera don’t feel that it’s necessary to respect line-height on inputs because they only contain one line of text, and most of the time this is fine, but if you are working with a strict baseline, or doing something similar to the example I linked to earlier, then problems arise.</p>
<h2>So what can we do?</h2>
<p>If we want reliable input heights no matter the browser, then we must declare a <code>height</code> as well as using <code>line-height</code>. This is important; if we just used <code>line-height</code>, the results would be inconsistent as each of the browsers that don’t allow altered line-heights on inputs render the ‘normal’ value slightly differently.</p>
<p>So while this won’t work in Firefox, Opera, or Internet Explorer:</p>
<p><pre>input {
    line-height: 2;
}</pre></p>
<p>This will:</p>
<p><pre>input {
    line-height: 2;
    height: 2em;
}</pre></p>
<h2>Update</h2>
<p>As mentioned by Neil in the comments, when using <code>height</code> to deal with the issue, there is really no need to use <code>line-height</code>. This saves you from having to declare the same value twice, and also avoids a <a href="http://code.google.com/p/chromium/issues/detail?id=47284">caret bug</a> in webkit</p>
 <img src="http://joshnh.com/?feed-stats-post-id=1297" width="1" height="1" style="display: none;" /><p>The post <a href="http://joshnh.com/2012/12/03/line-height-doesnt-work-as-expected-on-inputs/">Line-Height Doesn’t Work As Expected On Inputs</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://joshnh.com/2012/12/03/line-height-doesnt-work-as-expected-on-inputs/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>A Set of HTML Snippets for Sublime Text 2</title>
		<link>http://joshnh.com/2012/11/27/a-set-of-html-snippets-for-sublime-text-2/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=a-set-of-html-snippets-for-sublime-text-2</link>
		<comments>http://joshnh.com/2012/11/27/a-set-of-html-snippets-for-sublime-text-2/#comments</comments>
		<pubDate>Tue, 27 Nov 2012 08:47:47 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Sublime Text]]></category>

		<guid isPermaLink="false">http://joshnh.com/?p=1258</guid>
		<description><![CDATA[<p>Download Considering how popular my CSS snippets for Sublime Text have been, I thought I’d better collate and release some of the HTML snippets I use regularly. Put simply, they allow you to turn this: doctype Into this: &#60;!doctype html&#62; &#60;html&#62; &#60;head&#62; &#60;meta charset=&#34;utf-8&#34;&#62; &#60;meta http-equiv=&#34;X-UA-Compatible&#34; content=&#34;IE=edge,chrome=1&#34;&#62; &#60;meta name=&#34;description&#34; content=&#34;$1&#34;&#62; &#60;meta name=&#34;viewport&#34; content=&#34;width=device-width, initial-scale=1&#34;&#62; &#60;title&#62;$2&#60;/title&#62;...  <a href="http://joshnh.com/2012/11/27/a-set-of-html-snippets-for-sublime-text-2/" title="Read A Set of HTML Snippets for Sublime Text 2">Read more &#187;</a></p><p>The post <a href="http://joshnh.com/2012/11/27/a-set-of-html-snippets-for-sublime-text-2/">A Set of HTML Snippets for Sublime Text 2</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://joshnh.com/wp-content/uploads/2012/11/A-Set-of-HTML-Snippets-for-Sublime-Text-2.png" alt="A Set of HTML Snippets for Sublime Text 2"><span id="more-1258"></span></p>
<p><a class="download" href="https://github.com/joshnh/HTML-Snippets/archive/master.zip">Download</a></p>
<p>Considering how popular my <a href="http://joshnh.com/2012/02/03/a-collection-of-css-snippets-for-sublime-text-2/">CSS snippets</a> for Sublime Text have been, I thought I’d better collate and release some of the HTML snippets I use regularly. Put simply, they allow you to turn this:</p>
<p><pre>doctype</pre></p>
<p>Into this:</p>
<p><pre>&lt;!doctype html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;meta charset=&quot;utf-8&quot;&gt;
        &lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;IE=edge,chrome=1&quot;&gt;
        &lt;meta name=&quot;description&quot; content=&quot;$1&quot;&gt;
        &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
        &lt;title&gt;$2&lt;/title&gt;
        &lt;link rel=&quot;stylesheet&quot; href=&quot;css/main.css&quot;&gt;
    &lt;/head&gt;
    &lt;body&gt;
        $3
        &lt;script src=&quot;js/main.js&quot;&gt;&lt;/script&gt;
    &lt;/body&gt;
&lt;/html&gt;</pre></p>
<p><em>Note: the dollar signs indicate tab markers.</em></p>
<p>Further details can be found on the <a href="https://github.com/joshnh/HTML-Snippets">GitHub repository</a>. If you have any suggestions, send a pull request, or let me know in the comments below.</p>
<h2>Installation instructions</h2>
<p>The easiest way to install these snippets is through <a href="http://wbond.net/sublime_packages/package_control">Package Control</a>; simply search for ‘HTML snippets’. If you don’t use Package Control (you really should, it’s awesome) then you can copy the set into the Sublime Text packages folder. On a Mac this can be found in:</p>
<p><pre>Library &gt; Application Support &gt; Sublime Text 2 &gt; Packages</pre></p>
<p>For Windows, it can be found in:</p>
<p><pre>C: &gt; Users &gt; {username} &gt; AppData &gt; Roaming &gt; Sublime Text 2 &gt; Packages.</pre></p>
<p>Stay tuned for a more in-depth article on Sublime Text, including why I use it, a few hidden tricks, some of my favourite packages, and other work flow enhancements!</p>
<h2>Update</h2>
<p>If you are also using Emmet then you need to add the following to Emmet’s user settings file to avoid conflicts:</p>
<p><pre>&quot;disabled_single_snippets&quot;: &quot;fig meta nav ol script style ul&quot;</pre></p>
 <img src="http://joshnh.com/?feed-stats-post-id=1258" width="1" height="1" style="display: none;" /><p>The post <a href="http://joshnh.com/2012/11/27/a-set-of-html-snippets-for-sublime-text-2/">A Set of HTML Snippets for Sublime Text 2</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://joshnh.com/2012/11/27/a-set-of-html-snippets-for-sublime-text-2/feed/</wfw:commentRss>
		<slash:comments>43</slash:comments>
		</item>
		<item>
		<title>Don’t Forget the CSS Value ‘inherit’</title>
		<link>http://joshnh.com/2012/10/25/dont-forget-the-css-value-inherit/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=dont-forget-the-css-value-inherit</link>
		<comments>http://joshnh.com/2012/10/25/dont-forget-the-css-value-inherit/#comments</comments>
		<pubDate>Thu, 25 Oct 2012 06:45:02 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://joshnh.com/?p=1197</guid>
		<description><![CDATA[<p>I’ve been using the inherit value a lot more recently; it can easily reduce the amount of repetition in your style sheet. Here’s a basic example of what I am talking about. As you can see, when changing the values on the .foo element, the pseudo-element also changes accordingly. Here is another example. Bonus transition...  <a href="http://joshnh.com/2012/10/25/dont-forget-the-css-value-inherit/" title="Read Don’t Forget the CSS Value ‘inherit’">Read more &#187;</a></p><p>The post <a href="http://joshnh.com/2012/10/25/dont-forget-the-css-value-inherit/">Don’t Forget the CSS Value ‘inherit’</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://joshnh.com/wp-content/uploads/2012/10/Dont-Forget-the-CSS-Value-inherit.png" alt="Don&#039;t Forget the CSS Value inherit"><span id="more-1197"></span></p>
<p>I’ve been using the <em>inherit</em> value a lot more recently; it can easily reduce the amount of repetition in your style sheet. Here’s a <a href="http://jsfiddle.net/joshnh/yWpcs/">basic example</a> of what I am talking about. As you can see, when changing the values on the <code>.foo</code> element, the pseudo-element also changes accordingly. Here is <a href="http://jsfiddle.net/joshnh/LJ5zM/">another example</a>.</p>
<h2>Bonus transition trick</h2>
<p>At the moment, only Firefox supports transitions on pseudo-elements, but by making full use of inherit, we can trick other browsers into doing the same. Here is a <a href="http://jsfiddle.net/joshnh/Fa9PH/">demonstration</a> of how this works, and here is a more practicle <a href="http://jsfiddle.net/joshnh/ELDet/">example</a>.</p>
 <img src="http://joshnh.com/?feed-stats-post-id=1197" width="1" height="1" style="display: none;" /><p>The post <a href="http://joshnh.com/2012/10/25/dont-forget-the-css-value-inherit/">Don’t Forget the CSS Value ‘inherit’</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://joshnh.com/2012/10/25/dont-forget-the-css-value-inherit/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>How Does Line-Height Actually Work?</title>
		<link>http://joshnh.com/2012/10/12/how-does-line-height-actually-work/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=how-does-line-height-actually-work</link>
		<comments>http://joshnh.com/2012/10/12/how-does-line-height-actually-work/#comments</comments>
		<pubDate>Fri, 12 Oct 2012 06:34:37 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://joshnh.com/?p=1135</guid>
		<description><![CDATA[<p>The CSS property line-height seems pretty straightforward, but the way that it renders can cause some confusion when working out a typographic baseline. Here is an example of a 24px baseline (I am using pixels for simplicity, but I would generally use ems). Optically, it looks great, but let’s add a horizontal grid so that...  <a href="http://joshnh.com/2012/10/12/how-does-line-height-actually-work/" title="Read How Does Line-Height Actually Work?">Read more &#187;</a></p><p>The post <a href="http://joshnh.com/2012/10/12/how-does-line-height-actually-work/">How Does Line-Height Actually Work?</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://joshnh.com/wp-content/uploads/2012/10/How-Does-Line-Height-Actually-Work.png" alt="How Does Line-Height Actually Work?"><span id="more-1135"></span></p>
<p>The CSS property <code>line-height</code> seems pretty straightforward, but the way that it renders can cause some confusion when working out a typographic baseline. <a href="http://jsfiddle.net/joshnh/zbjCM/">Here is an example</a> of a <code>24px</code> baseline (I am using pixels for simplicity, but I would generally use ems). Optically, it looks great, but let’s add a horizontal grid so that we can see exactly what is going on. I’m going to align the grid to the bottom of the <code>h1</code>; everything else should then line up accordingly. <a href="http://jsfiddle.net/joshnh/Lucsf/">Here is the result</a>.</p>
<p>Uh oh, what happened? We can immediately see that the baseline doesn’t line up, despite having used a consistent <code>line-height</code> and <code>margin-bottom</code>. How can this be? Well actually, this is expected behavior.</p>
<p>Here’s the catch: a baseline on the web is not calculated in the same manner as a print baseline. The distance between lines of type in print is referred to as <em>leading</em>, and while this concept is used in CSS, it is not implemented in the same manner.</p>
<p>CSS uses what is known as <em>half-leading</em> to render lines of text. This is determined by working out the difference between the <code>line-height</code> and the <code>font-size</code>, dividing by 2, and then placing the calculated amount of space above and below each line of text. So if you have a <code>font-size</code> of <code>16px</code> and an effective <code>line-height</code> of <code>24px</code>, the half-leading would be <code>4px</code>. Here’s the process:</p>
<p><pre>24px − 16px = 8px</pre><br />
<pre>8px ÷ 2 = 4px</pre></p>
<p>So with that information, let’s have a look at <a href="http://jsfiddle.net/joshnh/udt3e/">how our baseline grid actually renders</a>. Keep in mind that I haven’t changed the baseline at all, I have only moved the position of the grid.</p>
<p>Understanding how <code>line-height</code> actually works was a real eye-opener for me. It can be a difficult concept to explain, but it becomes pretty obvious once you see it. So, if you’re anything like me (particular about baselines), you can now get on with your work and stop worrying about using magic numbers to get everything perfectly aligned.</p>
<p>For those of you that would rather use <code>ems</code>, <a href="http://jsfiddle.net/joshnh/GdAEf/">here is an updated baseline</a>.</p>
 <img src="http://joshnh.com/?feed-stats-post-id=1135" width="1" height="1" style="display: none;" /><p>The post <a href="http://joshnh.com/2012/10/12/how-does-line-height-actually-work/">How Does Line-Height Actually Work?</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://joshnh.com/2012/10/12/how-does-line-height-actually-work/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Increasing the Clickable Area of Inline Links</title>
		<link>http://joshnh.com/2012/09/06/increasing-the-clickable-area-of-inline-links/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=increasing-the-clickable-area-of-inline-links</link>
		<comments>http://joshnh.com/2012/09/06/increasing-the-clickable-area-of-inline-links/#comments</comments>
		<pubDate>Thu, 06 Sep 2012 02:29:40 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://joshnh.com/?p=743</guid>
		<description><![CDATA[<p>Demo It has been best practice for some time now to ensure that navigation links have appropriate padding. This makes clicking these links much easier, especially if you are on a mobile device. Here is an article, written four years ago, discussing this very idea. Why aren’t we taking this one step further? Links don’t...  <a href="http://joshnh.com/2012/09/06/increasing-the-clickable-area-of-inline-links/" title="Read Increasing the Clickable Area of Inline Links">Read more &#187;</a></p><p>The post <a href="http://joshnh.com/2012/09/06/increasing-the-clickable-area-of-inline-links/">Increasing the Clickable Area of Inline Links</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://joshnh.com/wp-content/uploads/2012/09/Increasing-the-Clickable-Area-of-Inline-Links.png" alt="Increasing the Clickable Area of Inline Links"><span id="more-743"></span></p>
<p><a class="download" href="http://jsfiddle.net/joshnh/FBPMX/show/">Demo</a></p>
<p>It has been best practice for some time now to ensure that navigation links have appropriate padding. This makes clicking these links much easier, especially if you are on a mobile device. <a href="http://37signals.com/svn/posts/1048-padded-link-targets-for-better-mousing">Here is an article</a>, written four years ago, discussing this very idea.</p>
<p>Why aren’t we taking this one step further? Links don’t only exist in menus, and inline links can be tricky to click accurately. Mobile users benefit the most from an increased click area, although I must admit that I occasionally misclick with my mouse too.</p>
<p>Now keep in mind that this is only a thought. There are almost certainly going to be some issues that I haven’t yet considered. One that is immediately apparent is that click areas can now overlap. As long as you keep this in mind, and don’t go crazy when increasing their size, I don’t think this will be a major concern. More often than not, links in body copy aren’t adjacent.</p>
<p>The trick is to be subtle with this technique; increase the click area enough that users don’t have to be 100% accurate, but don’t increase it too much so that the behavior becomes unexpected. It’s a pretty small change, but it’s the little things that make all the difference.</p>
<p>Here is an example of what the CSS rule might look like:</p>
<p><pre data-lang="css">p a {
    margin: -.5em;
    padding: .5em;
    position: relative;
}</pre></p>
<p>Notice the use of <code>position: relative</code>? This is due to a strange browser bug that doesn’t respect the right hand side of the click area if the position of the link is <code>static</code>.</p>
<p>What are your thoughts on this technique? I would love to start a discussion on the concept, and why it may, or may not be, a good idea.</p>
 <img src="http://joshnh.com/?feed-stats-post-id=743" width="1" height="1" style="display: none;" /><p>The post <a href="http://joshnh.com/2012/09/06/increasing-the-clickable-area-of-inline-links/">Increasing the Clickable Area of Inline Links</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://joshnh.com/2012/09/06/increasing-the-clickable-area-of-inline-links/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Looking for a Dribbble Invite?</title>
		<link>http://joshnh.com/2012/08/27/looking-for-a-dribbble-invite/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=looking-for-a-dribbble-invite</link>
		<comments>http://joshnh.com/2012/08/27/looking-for-a-dribbble-invite/#comments</comments>
		<pubDate>Mon, 27 Aug 2012 07:10:00 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[Dribbble]]></category>

		<guid isPermaLink="false">http://joshnh.com/?p=1026</guid>
		<description><![CDATA[<p>Well luckily for you, I have two to give away! This isn’t a contest, and there are no criteria that you have to meet. Simply send me a tweet with your Dribbble username and some work that you are proud of. When I feel like enough time has passed, I will invite two people of...  <a href="http://joshnh.com/2012/08/27/looking-for-a-dribbble-invite/" title="Read Looking for a Dribbble Invite?">Read more &#187;</a></p><p>The post <a href="http://joshnh.com/2012/08/27/looking-for-a-dribbble-invite/">Looking for a Dribbble Invite?</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://joshnh.com/wp-content/uploads/2012/08/Looking-for-a-Dribbble-Invite.png" alt="Looking for a Dribbble Invite"><span id="more-1026"></span></p>
<p>Well luckily for you, I have two to give away!</p>
<p>This isn’t a contest, and there are no criteria that you have to meet. Simply <a href="http://twitter.com/_joshnh">send me a tweet</a> with your Dribbble username and some work that you are proud of. When I feel like enough time has passed, I will invite two people of my choosing.</p>
<h2>Update</h2>
<p>Both invites have now been given out. Congratulations <a href="http://dribbble.com/tomoakley">Tom<a> and <a href="http://dribbble.com/cssdeck">CSS Deck</a>.</p>
 <img src="http://joshnh.com/?feed-stats-post-id=1026" width="1" height="1" style="display: none;" /><p>The post <a href="http://joshnh.com/2012/08/27/looking-for-a-dribbble-invite/">Looking for a Dribbble Invite?</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://joshnh.com/2012/08/27/looking-for-a-dribbble-invite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Drawing Things with Box-Shadow</title>
		<link>http://joshnh.com/2012/08/16/drawing-things-with-box-shadow/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=drawing-things-with-box-shadow</link>
		<comments>http://joshnh.com/2012/08/16/drawing-things-with-box-shadow/#comments</comments>
		<pubDate>Thu, 16 Aug 2012 02:08:51 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://joshnh.com/?p=935</guid>
		<description><![CDATA[<p>Demo This is a neat little trick that I stumbled upon when playing around with a CSS experiment a few months ago. Basically, by using multiple box-shadows, you can draw complex images with only a single element. As you may know, I’m a big fan of semantic markup, and I really don’t like using extra...  <a href="http://joshnh.com/2012/08/16/drawing-things-with-box-shadow/" title="Read Drawing Things with Box-Shadow">Read more &#187;</a></p><p>The post <a href="http://joshnh.com/2012/08/16/drawing-things-with-box-shadow/">Drawing Things with Box-Shadow</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><img src="http://joshnh.com/wp-content/uploads/2012/08/Drawing-Things-with-Box-Shadow1.png" alt="Drawing Things with Box-Shadow"><span id="more-935"></span></p>
<p><a class="download" href="http://codepen.io/joshnh/pen/JCGoF">Demo</a></p>
<p>This is a neat little trick that I stumbled upon when playing around with a CSS experiment a few months ago. Basically, by using multiple box-shadows, you can draw complex images with only a single element. As you may know, I’m a big fan of semantic markup, and I really don’t like using extra elements just for styling, so I was very happy with this discovery!</p>
<p>I played around with a few experiments that showcased the potential of this trick. These ranged from <a href="http://codepen.io/joshnh/pen/pygdC">favicons</a>, to <a href="http://codepen.io/joshnh/pen/rxAtE">logos</a> and <a href="http://codepen.io/joshnh/pen/tdvGn">typefaces</a>. It wasn’t long after posting these experiments on <a href="http://codepen.io/">CodePen</a> that I began to see other people using the technique to create <a href="http://codepen.io/jackrugile/pen/tGBAC">awesome</a> <a href="http://codepen.io/vladzinculescu/pen/buliv">things</a> of <a href="http://codepen.io/Kseso/pen/pmEah">their</a> <a href="http://codepen.io/travisneilson/pen/box-shadow-letters">own</a>.</p>
<p>It isn’t something that you would normally think to do with <code>box-shadow</code>, and as others are starting to use the technique, I thought I had better share how I do it.</p>
<h2>Okay, here’s the trick</h2>
<p>Firstly, let’s create a basic element that we will use for this explanation:</p>
<p><pre data-lang="html">&lt;div class=&quot;box-shadow-trick&quot;&gt;&lt;/div&gt;</pre><br />
<pre data-lang="css">.box-shadow-trick {
    background: #000;
    height: 10px;
    width: 10px;
}</pre></p>
<p>Alright, now let’s create a basic 4 × 4 checkerboard pattern using that element and the <code>box-shadow</code> property. We will need 15 shadows; a 4 × 4 checkerboard has 16 squares, but one of them will be the element itself. We aren’t going to use blur radius at all, only using the offset values. Here is the relevant code:</p>
<p><pre data-lang="css">box-shadow: 10px 0    0 #f00,
            20px 0    0 #000,
            30px 0    0 #f00,
            0    10px 0 #f00,
            10px 10px 0 #000,
            20px 10px 0 #f00,
            30px 10px 0 #000,
            0    20px 0 #000,
            10px 20px 0 #f00,
            20px 20px 0 #000,
            30px 20px 0 #f00,
            0    30px 0 #f00,
            10px 30px 0 #000,
            20px 30px 0 #f00,
            30px 30px 0 #000;</pre></p>
<p>So you can see that it isn’t too difficult to make <em>copies</em> of an element, and to position them wherever you would like. It can get even more interesting when you begin to use box-shadow’s optional spread value. The obvious downside to this technique is that it is a fair bit of code, but that shouldn’t be an issue for experiments.</p>
<h2>We can also use gradients to draw things</h2>
<p>The demo linked to at the top of this article showcases an experiment that uses both gradients and box-shadows to create a MacBook Pro using only a single element. You can use gradients on their own to create <a href="http://codepen.io/joshnh/pen/ucGsk">icons</a> or slightly more advanced <a href="http://codepen.io/joshnh/pen/iwmAp">logos</a>. The principle is the same: use multiple backgrounds (i.e. linear and radial gradients), and then use the other background properties such as repeat, position and size to get the effect you want.</p>
<h2>Another nifty trick</h2>
<p>Box-shadows, when used with transparent backgrounds, can produce some cool effects. <a href="http://jsfiddle.net/joshnh/XS7W4/">Here is an example</a> of what I’m talking about.</p>
<h2>Word of warning</h2>
<p>The techniques outlined in this article are a lot of fun, but they really shouldn’t be used in production. They are a nifty way to produce semantic CSS experiments, but they don’t have full browser support. Also, the <code>box-shadow</code> property can be one of the slowest to render, especially if you are chaining together tens, or even hundreds, of shadows!</p>
<h2>Your turn</h2>
<p>Now that you know my little secret, it’s your turn to get out there and experiment. I want to see what you guys can come up with! Leave your links for me in the comments. If I get enough, I’ll add them to the post.</p>
<h2>Updates</h2>
<p><a href="http://twitter.com/blaz_boy">Emad Elsaid</a> has cleverly developed an <a href="http://codepen.io/blazeeboy/pen/bCaLE">image to box-shadow converter</a>, so now you can make things like <a href="http://codepen.io/midday/pen/vFjxu">this</a>! Keep in mind that it pumps out an incredible amount of shadows, so don’t use large images!</p>
<p>Also, <a href="https://twitter.com/hugogiraudel">Hugo Giraudel</a> has hand drawn <a href="http://codepen.io/HugoGiraudel/pen/gpcwa">this incredible piece</a>.</p>
<p>Thanks to <a href="https://github.com/h5bp/lazyweb-requests/issues/99">a request</a> from <a href="https://twitter.com/paul_irish">Paul Irish</a>, I have also created <a href="http://codepen.io/joshnh/pen/ohbHl">this little piece of internet history</a>.</p>
<p>If you are interest in seeing me tweak one of these experiments, you can check out <a href="http://cl.ly/403b2t2Q451m">this screencast</a>.</p>
 <img src="http://joshnh.com/?feed-stats-post-id=935" width="1" height="1" style="display: none;" /><p>The post <a href="http://joshnh.com/2012/08/16/drawing-things-with-box-shadow/">Drawing Things with Box-Shadow</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://joshnh.com/2012/08/16/drawing-things-with-box-shadow/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Making a Pure CSS Featured Image Slider</title>
		<link>http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=making-a-pure-css-featured-image-slider</link>
		<comments>http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/#comments</comments>
		<pubDate>Tue, 14 Aug 2012 05:02:01 +0000</pubDate>
		<dc:creator>Josh</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://joshnh.com/?p=835</guid>
		<description><![CDATA[<p>Demo CSS3 has given us some pretty powerful tools. Not so long ago we had to use JavaScript if we wanted an image slider, but now it isn’t too hard to do it with only CSS. This article will explain how. I have tried to keep this as to the point as possible, so if...  <a href="http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/" title="Read Making a Pure CSS Featured Image Slider">Read more &#187;</a></p><p>The post <a href="http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/">Making a Pure CSS Featured Image Slider</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/"><img src="http://joshnh.com/wp-content/uploads/2012/06/Making-a-Pure-CSS-Featured-Image-Slider.png" alt="Making a Pure CSS Featured Image Slider" /></a><span id="more-835"></span></p>
<p><a class="download" href="http://codepen.io/joshnh/full/KwilB">Demo</a></p>
<p>CSS3 has given us some pretty powerful tools. Not so long ago we had to use JavaScript if we wanted an image slider, but now it isn’t too hard to do it with only CSS. This article will explain how.</p>
<p>I have tried to keep this as <em>to the point</em> as possible, so if you want me to clarify anything, feel free to ask. Also, keep in mind that you will need to use browser prefixes where required.</p>
<h2>The plan</h2>
<ol>
<li><a href="#step1">The markup</a></li>
<li><a href="#step2">Basic styl­ing</a></li>
<li><a href="#step3">Navigating</a></li>
<li><a href="#step4">Finishing touches</a></li>
</ol>
<p>Want to see the fin­ished code? <a href="#final-product">Click here</a>.</p>
<h2 id="step1">Step 1: The markup</h2>
<p>Let’s get the foundation worked out. This slider will contain four panels, so let’s write up an unordered list containing four images. We will give it a class of <code>slider</code> so that we can target it in our style sheet. I am using images that are roughly 400 × 240, but feel free to use whatever size you would like.</p>
<p><pre data-lang="html">&lt;ul class=&quot;slider&quot;&gt;
    &lt;li&gt;
        &lt;img src=&quot;http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/&quot;Panel 1&quot;&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;img src=&quot;http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/&quot;Panel 2&quot;&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;img src=&quot;http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/&quot;Panel 3&quot;&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;img src=&quot;http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/&quot;Panel 4&quot;&gt;
    &lt;/li&gt;
&lt;/ul&gt;</pre></p>
<h2 id="step2">Step 2: Basic styl­ing</h2>
<p>I am using <code>em</code> instead of <code>px</code> to size up this slider. If you aren’t that comfortable with using <code>em</code> then <a href="http://joshnh.com/2011/08/03/how-to-set-up-a-baseline-grid/">this article</a> may help, otherwise, feel free to simply multiple any value by 16, and use that as a pixel value instead.</p>
<p><pre data-lang="css">.slider {
    height: 15em;
    width: 25em;
}
.slider li {
    list-style: none;
    position: absolute;
}
.slider img {
    height: 15em;
    width: 25em;
    vertical-align: top;
}
</pre></p>
<p>The height and width on the image aren’t strictly required, but they do guarantee that any larger images are resized to fit within the slider.</p>
<h2 id="step3">Step 3: Navigating</h2>
<p>Now that we have the basics sorted, let’s introduce a technique that will allow us to navigate between the slides. To do this, I am going to use what is known as the <em>checkbox hack</em> (see <a href="http://css-tricks.com/the-checkbox-hack/">here</a> for more information).</p>
<p>Let’s add some form elements to our markup.</p>
<p><pre data-lang="html">&lt;ul class=&quot;slider&quot;&gt;
    &lt;li&gt;
        &lt;input type=&quot;radio&quot; id=&quot;slide1&quot; name=&quot;slide&quot; checked&gt;
        &lt;label for=&quot;slide1&quot;&gt;&lt;/label&gt;
        &lt;img src=&quot;http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/&quot;Panel 1&quot;&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;input type=&quot;radio&quot; id=&quot;slide2&quot; name=&quot;slide&quot;&gt;
        &lt;label for=&quot;slide2&quot;&gt;&lt;/label&gt;
        &lt;img src=&quot;http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/&quot;Panel 2&quot;&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;input type=&quot;radio&quot; id=&quot;slide3&quot; name=&quot;slide&quot;&gt;
        &lt;label for=&quot;slide3&quot;&gt;&lt;/label&gt;
        &lt;img src=&quot;http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/&quot;Panel 3&quot;&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;input type=&quot;radio&quot; id=&quot;slide4&quot; name=&quot;slide&quot;&gt;
        &lt;label for=&quot;slide4&quot;&gt;&lt;/label&gt;
        &lt;img src=&quot;http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/&quot;Panel 4&quot;&gt;
    &lt;/li&gt;
&lt;/ul&gt;</pre></p>
<p>You may have noticed that I marked the first radio button as <code>checked</code>. The checked image will be the one showing on page load. The others will be hidden so that we can fade them in when they are selected. We will do that via the following CSS:</p>
<p><pre data-lang="css">.slider input {
    display: none;
}
.slider label {
    background-color: #111;
    bottom: .5em;
    cursor: pointer;
    display: block;
    height: .5em;
    position: absolute;
    width: .5em;
    z-index: 10;
}
.slider li:nth-child(1) label {
    left: .5em;
}
.slider li:nth-child(2) label {
    left: 2em;
}
.slider li:nth-child(3) label {
    left: 3.5em;
}
.slider li:nth-child(4) label {
    left: 5em;
}
.slider img {
    opacity: 0;
    visibility: hidden;
}
.slider li input:checked ~ img {
    opacity: 1;
    visibility: visible;
    z-index: 10;
}</pre></p>
<p>Awesome, we now have an interactive slider using only CSS!</p>
<h2 id="step4">Step 4: Finishing touches</h2>
<p>Alright, now it’s time to have some fun! Feel free to style the slider however you like. If you would like to see what I did, keep reading.</p>
<p>With the use of pseudo-elements and <code>box-shadow</code>, I’m going to transform our boring looking slider into a picture frame. I’ll use a few transitions to make it smooth, and hide the navigation elements until the slider is hovered. Check out my final code below.</p>
<h2 id="final-product">Final product</h2>
<p><pre data-lang="html">&lt;ul class=&quot;slider&quot;&gt;
    &lt;li&gt;
        &lt;input type=&quot;radio&quot; id=&quot;slide1&quot; name=&quot;slide&quot; checked&gt;
        &lt;label for=&quot;slide1&quot;&gt;&lt;/label&gt;
        &lt;img src=&quot;http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/&quot;Panel 1&quot;&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;input type=&quot;radio&quot; id=&quot;slide2&quot; name=&quot;slide&quot;&gt;
        &lt;label for=&quot;slide2&quot;&gt;&lt;/label&gt;
        &lt;img src=&quot;http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/&quot;Panel 2&quot;&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;input type=&quot;radio&quot; id=&quot;slide3&quot; name=&quot;slide&quot;&gt;
        &lt;label for=&quot;slide3&quot;&gt;&lt;/label&gt;
        &lt;img src=&quot;http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/&quot;Panel 3&quot;&gt;
    &lt;/li&gt;
    &lt;li&gt;
        &lt;input type=&quot;radio&quot; id=&quot;slide4&quot; name=&quot;slide&quot;&gt;
        &lt;label for=&quot;slide4&quot;&gt;&lt;/label&gt;
        &lt;img src=&quot;http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/&quot;Panel 4&quot;&gt;
    &lt;/li&gt;
&lt;/ul&gt;​</pre><br />
<pre data-lang="css">.slider {
    background-color: #fff;
    box-shadow: inset 0 0 2px hsla(0,0%,0%,.2),
                0 3px 1px hsla(0,0%,100%,.75),
                0 -1px 1px 2px hsla(0,0%,0%,.1);
    height: 15em;
    left: 50%;
    margin: -8em -13em;
    padding: .5em;
    position: absolute;
    top: 50%;
    width: 25em;
}
.slider:before {
    background-color: #22130c;
    bottom: -2.5em;
    box-shadow: inset 0 1px 1px 1px hsla(0,0%,100%,.2),
                inset 0 -2px 1px hsla(0,0%,0%,.4),
                0 5px 50px hsla(0,0%,0%,.25),
                0 20px 20px -15px hsla(0,0%,0%,.2),
                0 30px 20px -15px hsla(0,0%,0%,.15),
                0 40px 20px -15px hsla(0,0%,0%,.1);
    content: &#039;&#039;;
    left: -2.5em;
    position: absolute;
    right: -2.5em;
    top: -2.5em;
    z-index: -1;
}
.slider:after {
    background-color: #fff5e5;
    bottom: -1.5em;
    box-shadow: 0 2px 1px hsla(0,0%,100%,.2),
                0 -1px 1px 1px hsla(0,0%,0%,.4),
                inset 0 2px 3px 1px hsla(0,0%,0%,.2),
                inset 0 4px 3px 1px hsla(0,0%,0%,.2),
                inset 0 6px 3px 1px hsla(0,0%,0%,.1);
    content: &#039;&#039;;
    left: -1.5em;
    position: absolute;
    right: -1.5em;
    top: -1.5em;
    z-index: -1;
}
.slider li {
    box-shadow: 0 -1px 0 2px hsla(0,0%,0%,.03);
    list-style: none;
    position: absolute;
}
.slider input {
    display: none;
}
.slider label {
    background-color: #111;
    background-image: linear-gradient(transparent, hsla(0,0%,0%,.25));
    border: .2em solid transparent;
    bottom: .5em;
    border-radius: 100%;
    cursor: pointer;
    display: block;
    height: .5em;
    left: 24em;
    opacity: 0;
    position: absolute;
    transition: .25s;
    width: .5em;
    visibility: hidden;
    z-index: 10;
}
.slider label:after {
    border-radius: 100%;
    bottom: -.2em;
    box-shadow: inset 0 0 0 .2em #111,
                inset 0 2px 2px #000,
                0 1px 1px hsla(0,0%,100%,.25);
    content: &#039;&#039;;
    left: -.2em;
    position: absolute;
    right: -.2em;
    top: -.2em;
}
.slider:hover label {
    opacity: 1;
    visibility: visible;
}
.slider input:checked + label {
    background-color: #fff;
}
.slider:hover li:nth-child(1) label {
    left: .5em;
}
.slider:hover li:nth-child(2) label {
    left: 2em;
}
.slider:hover li:nth-child(3) label {
    left: 3.5em;
}
.slider:hover li:nth-child(4) label {
    left: 5em;
}
.slider img {
    height: 15em;
    opacity: 0;
    transition: .25s;
    width: 25em;
    vertical-align: top;
    visibility: hidden;
}
.slider li input:checked ~ img {
    opacity: 1;
    visibility: visible;
    z-index: 10;
}</pre></p>
 <img src="http://joshnh.com/?feed-stats-post-id=835" width="1" height="1" style="display: none;" /><p>The post <a href="http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/">Making a Pure CSS Featured Image Slider</a> appeared first on <a href="http://joshnh.com">Joshua Hibbert</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://joshnh.com/2012/08/14/making-a-pure-css-featured-image-slider/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced

 Served from: joshnh.com @ 2013-05-19 09:24:16 by W3 Total Cache -->
