<?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>Inspect Element &#187; Tutorials</title>
	<atom:link href="http://inspectelement.com/category/tutorials/feed/" rel="self" type="application/rss+xml" />
	<link>http://inspectelement.com</link>
	<description>Web Design &#38; Development Blog</description>
	<lastBuildDate>Thu, 09 Sep 2010 08:21:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Simulate Realism with CSS3</title>
		<link>http://inspectelement.com/tutorials/simulate-realism-with-css3/</link>
		<comments>http://inspectelement.com/tutorials/simulate-realism-with-css3/#comments</comments>
		<pubDate>Tue, 16 Feb 2010 15:15:09 +0000</pubDate>
		<dc:creator>Tom Kenny</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://inspectelement.com/?p=6577</guid>
		<description><![CDATA[CSS3 is here to make our lives easier as web designers and developers. While it's not something we can always rely on heavily for layout purposes just yet, we can use it to enhance certain aspects of our designs by spending a considerably less amount of time doing so.

However, CSS3 has not been created for the sole purpose of making it easier and quicker to create a website but also so we can create much better sites than we ever could with CSS before. Here are a few examples of how CSS3]]></description>
			<content:encoded><![CDATA[<p>CSS3 is here to make our lives easier as web designers and developers. While it&#8217;s not something we can always rely on heavily for layout purposes just yet, we can use it to <em>enhance</em> certain aspects of our designs by spending a considerably less amount of time doing so.</p>
<p><img class="alignnone size-full wp-image-6599" title="css3realism" src="http://inspectelement.com/wp-content/uploads/2010/02/css3realism.jpg" alt="" width="555" height="216" /></p>
<p>However, CSS3 has not been created for the sole purpose of making it easier and quicker to create a website but also so we can create much better sites than we ever could with CSS before. Here are a few examples of how CSS3 can improve the web.<span id="more-6577"></span><strong> </strong></p>
<h3>Polaroids – <a href="http://inspectelement.com/demos/css3/realism/polaroids.html">View Demo</a></h3>
<p><a href="http://inspectelement.com/demos/css3/realism/polaroids.html"><img class="alignnone size-full wp-image-6593" title="polaroid" src="http://inspectelement.com/wp-content/uploads/2010/02/polaroid.jpg" alt="" width="555" height="305" /></a></p>
<p>Despite not being around today, polaroid images are still iconic and because of this is still a great way to display photos. It&#8217;s simple enough to display a basic polaroid image using a white border on all sides with a thicker border for the bottom but we can enhance it with CSS3. As you&#8217;ll see in the <a href="http://inspectelement.com/demos/css3/realism/polaroids.html">demo</a>, viewed in the latest versions of Safari, Firefox or Chrome, you can add an extra layer of depth with the addition of <strong>drop-shadow</strong> and <strong>transitions</strong>.</p>
<pre><code>img {
	border: 15px solid #fff;
	border-bottom: 65px solid #fff;
	-webkit-box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
	-moz-box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
	-webkit-transform: rotate(1deg);
	-moz-transform: rotate(1deg);
}

img:hover {
	-webkit-box-shadow: 6px 6px 8px rgba(0, 0, 0, 0.1);
	-moz-box-shadow: 6px 6px 8px rgba(0, 0, 0, 0.1);
	-webkit-transform: rotate(1deg) scale(1.05);
	-moz-transform: rotate(1deg) scale(1.05);
}</code></pre>
<p>A subtle shadow gives the impression that is sitting on a flat surface and by scaling and increasing the size and positioning of the shadow on a hover state we can create the illusion that it has been raised slightly from the surface.</p>
<h3>Buttons – <a href="http://inspectelement.com/demos/css3/realism/buttons.html">View Demo</a></h3>
<p><a href="http://inspectelement.com/demos/css3/realism/buttons.html"><img class="alignnone size-full wp-image-6602" title="buttons" src="http://inspectelement.com/wp-content/uploads/2010/02/buttons.jpg" alt="" width="555" height="187" /></a></p>
<p>Why do buttons exist in web design? The web is an interactive medium and buttons are a form of interaction, they are easy to understand as a metaphor for real, physical buttons we use everyday on things like computers, mp3 players, televisions and any other electronic devices we use on a daily basis.</p>
<p>The key to making the buttons behave more like real physical buttons using CSS3 is using code such as shown below for the second button. To achieve a circle with CSS3, set a width and a height and define <strong>border-radius</strong> as half of those values.</p>
<pre><code>button.two {
	width: 30px;
	height: 30px;
	-webkit-border-radius: 15px;
	-moz-border-radius: 15px;
	border-radius: 15px;
	text-indent: -9999px;
	border: 1px solid #696969;
	background: #696969 url(power.png) no-repeat 6px 5px;
}</code></pre>
<p><code> </code></p>
<p>The active state uses CSS3&#8242;s gradient ability to create a gradient that goes from dark at the top to a lighter colour at the bottom. To further emphasise the depression of a button, a CSS transform is applied, scaling down the button slightly. To maintain the background image of the power button, include it in the background property and separate the gradient values with a comma.</p>
<pre><code>button.two:active {
	-webkit-transform: scale(0.97);
	-moz-transform: scale(0.97);
	background: url(power.png) no-repeat 6px 5px, -webkit-gradient(
		linear,
		left bottom,
		left top,
		color-stop(0.13, #696969),
		color-stop(0.72, #2a2a2a)
	);
	background: url(power.png) no-repeat 6px 5px, -moz-linear-gradient(
		center bottom,
		#696969 13%,
		#2a2a2a 62%
	);
}</code></pre>
<p><code> </code></p>
<p>The recessed border also uses CSS3 gradient to get the full effect. The border class is applied to a div containing the button.</p>
<pre><code>.border {
	margin: 0 auto;
	height: 42px;
	width: 42px;
	display: block;
	background-color: #fcfcfc;
	-webkit-border-radius: 21px;
	-moz-border-radius: 21px;
	border-radius: 21px;
	background: -webkit-gradient(
	    linear,
	    left bottom,
	    left top,
	    color-stop(0.13, #fcfcfc),
	    color-stop(0.72, #c0c0c0)
	);
	background: -moz-linear-gradient(
	    center bottom,
	    #fcfcfc 13%,
	    #c0c0c0 62%
	);
	-webkit-box-shadow: 0px 1px 1px rgba(255, 255, 255, 0.6);
}</code></pre>
<p><a href="http://inspectelement.com/demos/css3/realism/buttons.html">View the demo</a> in the latest versions of Safari, Chrome or Firefox.</p>
<h3>DVD Animation – <a href="http://inspectelement.com/demos/css3/realism/dvd.html">View Demo</a></h3>
<p><a href="http://inspectelement.com/demos/css3/realism/dvd.html"><img class="alignnone size-full wp-image-6615" title="dvdanim" src="http://inspectelement.com/wp-content/uploads/2010/02/dvdanim.jpg" alt="" width="555" height="266" /></a></p>
<p>CSS3 has an <a href="http://www.w3.org/TR/css3-animations/">animation module</a> which is plenty of fun to play with especially as you&#8217;ll be able to do things with CSS that you weren&#8217;t able to do before.</p>
<pre><code>a:hover img[alt*="Disc"] {
	-moz-transform: translate(50px,0) rotate(330deg);
	-webkit-transform: translate(50px,0) rotate(330deg);
	transform: translate(50px,0) rotate(330deg);
}</code></pre>
<p>Here the animation is being used to animate the DVDs as as you hover over the link that encapsulates bot the cover and the disc.</p>
<pre><code>img[alt*="Disc"] {
	-moz-transition: all .5s ease-in-out;
	-webkit-transition: all .5s ease-in-out;
	transition: all .5s ease-in-out;
}
</code></pre>
<p>Anyone who follows the work of <a href="http://twitter.com/mALarKeY">Andy Clarke</a> will likely have seen the DVD animation of the homepage of <a href="http://forabeautifulweb.com/">For a Beautiful Web</a>. The above code demonstrates how Andy implemented this effect. At this point I want to highlight what you can do when you see something interesting on the web. All you have to do is have a look at the source code to see exactly how it works and learn from it to see how you could use it in the future. Now I&#8217;m not saying copy someone&#8217;s work but adjust it to your or your client&#8217;s needs.</p>
<p>Zurb also have an <a href="http://www.zurb.com/playground/sliding-vinyl">excellent demonstration</a> of a similar effect which the wrote for <a href="http://www.smashingmagazine.com/2010/01/25/the-new-hotness-using-css3-visual-effects/">Smashing Magazine</a>.</p>
<h3>BONUS: 3D Book Animation – <a href="http://inspectelement.com/demos/css3/realism/book.html">View Demo</a></h3>
<p><a href="http://inspectelement.com/demos/css3/realism/book.html"><img class="alignnone size-full wp-image-6614" title="bookanim" src="http://inspectelement.com/wp-content/uploads/2010/02/bookanim.jpg" alt="" width="555" height="431" /></a></p>
<p>This one is for WebKit based browsers only so fire up the latest version of Safari or Chrome to see it <a href="http://inspectelement.com/demos/css3/realism/book.html">in action</a> and is based on <a href="http://webkit.org/blog-files/3d-transforms/image-flip.html">this example</a> found on the <a href="http://webkit.org/blog/">Surfin&#8217; Safari blog</a>. I&#8217;ll let you hunt around for code to see how it works as discovery is half the fun of learning about CSS. If you have any questions let me know in the comments and either myself or one of our great readers will help you out.</p>
]]></content:encoded>
			<wfw:commentRss>http://inspectelement.com/tutorials/simulate-realism-with-css3/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>Code a Backwards Compatible, One Page Portfolio with HTML5 and CSS3</title>
		<link>http://inspectelement.com/tutorials/code-a-backwards-compatible-one-page-portfolio-with-html5-and-css3/</link>
		<comments>http://inspectelement.com/tutorials/code-a-backwards-compatible-one-page-portfolio-with-html5-and-css3/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 21:12:14 +0000</pubDate>
		<dc:creator>Tom Kenny</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://inspectelement.com/?p=6298</guid>
		<description><![CDATA[HTML5 is the future of web development but believe it or not you can start using it today. HTML5 is much more considerate to semantics and accessibility as we don't have to throw meaningless div's everywhere. It introduces meaningful tags for common elements such as navigations and footers which makes much more sense and are more natural.

This is a run through of the basics of HTML5 and CSS3 while still paying attention to older browsers. ]]></description>
			<content:encoded><![CDATA[<p>HTML5 is the future of web development but believe it or not you can start using it today. HTML5 is much more considerate to semantics and accessibility as we don&#8217;t have to throw meaningless div&#8217;s everywhere. It introduces meaningful tags for common elements such as navigations and footers which makes much more sense and are more natural.</p>
<p>This is a run through of the basics of HTML5 and CSS3 while still paying attention to older browsers. Before we start, make note of the answer to this question. <a href="http://dowebsitesneedtolookexactlythesameineverybrowser.com/">Do websites need to look exactly the same in every browser?</a></p>
<p style="font-size: 24px;"><a style="font-size: 24px;" href="http://inspectelement.com/html5portfolio/">View Demo</a> | <a style="font-size: 24px;" href="http://inspectelement.com/html5portfolio/HTML5_portfolio.zip">Download Files (.zip)</a></p>
<p><img title="html5portfolio" src="http://inspectelement.com/wp-content/uploads/2010/01/html5portfolio.jpg" alt="" width="555" height="216" /></p>
<p><span id="more-6298"></span><strong></strong></p>
<h3><strong>The HTML</strong></h3>
<pre><code><span>&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;

&lt;!-- This is a demonstration of HTML5 goodness with healthy does of CSS3 mixed in --&gt;
&lt;head&gt;

    &lt;title&gt;One Page Portfolio&lt;/title&gt;
    &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8" /&gt;

    &lt;!--[if IE]&gt;
    	&lt;script src="<a class="linkifyplus" href="http://html5shiv.googlecode.com/svn/trunk/html5.js">http://html5shiv.googlecode.com/svn/trunk/html5.js</a>"&gt;&lt;/script&gt;
    &lt;![endif]--&gt;

    &lt;!--[if IE 7]&gt;
    	&lt;link rel="stylesheet" href="ie7.css" type="text/css" media="screen" /&gt;
    &lt;![endif]--&gt;

    &lt;link rel="stylesheet" href="style.css" type="text/css" media="screen" /&gt;

    &lt;script src="<a class="linkifyplus" href="http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js">http://ajax.googleapis.com/ajax/libs/jquery/1.4.0/jquery.min.js</a>" type="text/javascript"&gt;&lt;/script&gt;
    &lt;script src="js/jquery.anchor.js" type="text/javascript"&gt;&lt;/script&gt;
    &lt;script src="js/jquery.fancybox-1.2.6.pack.js" type="text/javascript"&gt;&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;

    &lt;header&gt; &lt;!-- HTML5 header tag --&gt;

    	&lt;div id="headercontainer"&gt;

    		&lt;h1&gt;&lt;a class="introlink anchorLink" href="#intro"&gt;Web Design Portfolio&lt;/a&gt;&lt;/h1&gt;

    		&lt;nav&gt; &lt;!-- HTML5 navigation tag --&gt;
    			&lt;ul&gt;
    				&lt;li&gt;&lt;a class="introlink anchorLink" href="#intro"&gt;Intro&lt;/a&gt;&lt;/li&gt;
    				&lt;li&gt;&lt;a class="portfoliolink anchorLink" href="#portfolio"&gt;Portfolio&lt;/a&gt;&lt;/li&gt;
    				&lt;li&gt;&lt;a class="aboutlink anchorLink" href="#about"&gt;About&lt;/a&gt;&lt;/li&gt;
    				&lt;li&gt;&lt;a class="contactlink anchorLink" href="#contact"&gt;Contact&lt;/a&gt;&lt;/li&gt;
    			&lt;/ul&gt;
    		&lt;/nav&gt;

    	&lt;/div&gt;

    &lt;/header&gt;

    &lt;section id="contentcontainer"&gt; &lt;!-- HTML5 section tag for the content 'section' --&gt;

    	&lt;section id="intro"&gt;

    		&lt;h2 class="intro"&gt;Hand-coded &lt;strong&gt;HTML&lt;/strong&gt; and &lt;strong&gt;CSS&lt;/strong&gt; is what I do. &lt;span class="sub"&gt;It's what I'm good at so why not?&lt;/span&gt;&lt;/h2&gt;

    		&lt;a class="featured" href="<a class="linkifyplus" href="http://inspectelement.com">http://inspectelement.com</a>"&gt;&lt;img src="images/featured.gif" alt="Inspect Element large preview" /&gt;&lt;/a&gt;

    		&lt;p&gt;Featured Project: &lt;a href="#"&gt;Inspect Element&lt;/a&gt;&lt;/p&gt;

    	&lt;/section&gt;

    	&lt;section id="portfolio"&gt; &lt;!-- HTML5 section tag for the portfolio 'section' --&gt;

    		&lt;h2 class="work"&gt;My Portfolio&lt;/h2&gt;

    		&lt;ul class="work"&gt;
    			&lt;li&gt;
    				&lt;a href="<a class="linkifyplus" href="http://inspectelement.com">http://inspectelement.com</a>"&gt;&lt;img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /&gt;&lt;/a&gt;
    			&lt;/li&gt;
    			&lt;li&gt;
    				&lt;a href="<a class="linkifyplus" href="http://inspectelement.com">http://inspectelement.com</a>"&gt;&lt;img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /&gt;&lt;/a&gt;
    			&lt;/li&gt;
    			&lt;li&gt;
    				&lt;a href="<a class="linkifyplus" href="http://inspectelement.com">http://inspectelement.com</a>"&gt;&lt;img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /&gt;&lt;/a&gt;
    			&lt;/li&gt;
    			&lt;li&gt;
    				&lt;a href="<a class="linkifyplus" href="http://inspectelement.com">http://inspectelement.com</a>"&gt;&lt;img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /&gt;&lt;/a&gt;
    			&lt;/li&gt;
    			&lt;li&gt;
    				&lt;a href="<a class="linkifyplus" href="http://inspectelement.com">http://inspectelement.com</a>"&gt;&lt;img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /&gt;&lt;/a&gt;
    			&lt;/li&gt;
    			&lt;li&gt;
    				&lt;a href="<a class="linkifyplus" href="http://inspectelement.com">http://inspectelement.com</a>"&gt;&lt;img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /&gt;&lt;/a&gt;
    			&lt;/li&gt;
    			&lt;li&gt;
    				&lt;a href="<a class="linkifyplus" href="http://inspectelement.com">http://inspectelement.com</a>"&gt;&lt;img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /&gt;&lt;/a&gt;
    			&lt;/li&gt;
    			&lt;li&gt;
    				&lt;a href="<a class="linkifyplus" href="http://inspectelement.com">http://inspectelement.com</a>"&gt;&lt;img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /&gt;&lt;/a&gt;
    			&lt;/li&gt;
    			&lt;li&gt;
    				&lt;a href="<a class="linkifyplus" href="http://inspectelement.com">http://inspectelement.com</a>"&gt;&lt;img src="images/inspectelementSmall.jpg" alt="Inspect Element preview" /&gt;&lt;/a&gt;
    			&lt;/li&gt;
    		&lt;/ul&gt;

    	&lt;/section&gt;

    	&lt;section id="about"&gt; &lt;!-- HTML5 section tag for the about 'section' --&gt;

    		&lt;h2 class="about"&gt;About Me&lt;/h2&gt;

    		&lt;p&gt;Now this is a story all about how my life got twisted upside down and I'd like to take a minute just sit right there I'll tell you how I became the prince of a town called Bel-Air. In West Philadelphia born and raised on the playground my momma said most of my days chilling out, maxing and relaxing all cool and all shooting some b-ball outside of school when a couple of guys they were up to no good started making trouble in our neighbourhood I got in one little fight and my mom got scared, she said your moving in with your auntie and uncle in Bel-Air&lt;/p&gt;

    	&lt;/section&gt;

    	&lt;section id="contact"&gt; &lt;!-- HTML5 section tag for the contact 'section' --&gt;

    		&lt;h2 class="contact"&gt;Contact Me&lt;/h2&gt;

    		&lt;p&gt;I whistled for a cab and when it came near the license plate said fresh and had dice in the mirror, if anything I could say that this cab was rare but I thought nah, &lt;a href=""&gt;forget it&lt;/a&gt;, yo home to Bel-Air! I pulled up to the house about seven or eight I yelled to the cabbie yo home, smell you later, looked at my kingdom I was finally there to sit on my throne as the prince of Bel-Air&lt;/p&gt;

    		&lt;form id="contactform"&gt; 

    			&lt;p&gt;&lt;label for="name"&gt;Name&lt;/label&gt;&lt;/p&gt;
    			&lt;input type="text" id=name name=name placeholder="First and last name" required tabindex="1" /&gt; 

    			&lt;p&gt;&lt;label for="email"&gt;Email&lt;/label&gt;&lt;/p&gt;
    			&lt;input type="text" id=email name=email placeholder="<a class="linkifyplus" href="mailto:example@domain.com">example@domain.com</a>" required tabindex="2" /&gt; 

    			&lt;p&gt;&lt;label for="comment"&gt;Your Message&lt;/label&gt;&lt;/p&gt;
    			&lt;textarea name="comment" id="comment" tabindex="4"&gt;&lt;/textarea&gt; 

    			&lt;input name="submit" type="submit" id="submit" tabindex="5" value="Send Message" /&gt; 

    		&lt;/form&gt; 

    	&lt;/section&gt;

    	&lt;footer&gt; &lt;!-- HTML5 footer tag --&gt;

    		&lt;ul&gt;
    			&lt;li&gt;&lt;img src="images/twitter.png" alt="" /&gt;&lt;a href="<a class="linkifyplus" href="http://twitter.com/tkenny">http://twitter.com/tkenny</a>"&gt;Follow me on Twitter&lt;/a&gt;&lt;/li&gt;
    			&lt;li&gt;&lt;a href="<a class="linkifyplus" href="http://inspectelement.com/articles/code-a-backwards-compatible-one-page-portfolio-with-html5-and-css3">http://inspectelement.com/articles/code-a-backwards-compatible-one-page-portfolio-with-html5-and-css3</a>"&gt;Back to the Tutorial on Inspect Element&lt;/a&gt;&lt;/li&gt;
    		&lt;/ul&gt;

    	&lt;/footer&gt;	

    &lt;/section&gt;

&lt;/body&gt;

&lt;/html&gt;</span></code></pre>
<p><a href="http://inspectelement.com/html5portfolio/index.html">Download the HTML here</a> (Right-click and save as).</p>
<p>First thing first, let&#8217;s make sure the <a href="http://validator.w3.org/check?uri=http%3A%2F%2Finspectelement.com%2Fhtml5portfolio%2F">code validates</a> with W3C&#8217;s experimental HTML5 validator.</p>
<p><img class="alignnone size-full wp-image-6323" title="html5validate" src="http://inspectelement.com/wp-content/uploads/2010/01/html5validate.gif" alt="" width="555" height="28" /></p>
<p>Good news, it does! This is a simple example but good to know we&#8217;re on the right lines.</p>
<h3>The HTML5 Goodness</h3>
<p>As you can see from the code above there are new tags that you may not be familiar with. To make it even simpler here is the code stripped down to only the HTML5 tags.</p>
<pre><code>&lt;header&gt; &lt;!-- HTML5 header tag --&gt;

        &lt;nav&gt; &lt;!-- HTML5 navigation tag --&gt;
	&lt;/nav&gt;

&lt;/header&gt; 

&lt;section id="contentcontainer"&gt; &lt;!-- HTML5 section tag for the content 'section' --&gt;

	&lt;section id="intro"&gt; &lt;!-- HTML5 section tag for the introduction 'section' --&gt;
	&lt;/section&gt;

	&lt;section id="portfolio"&gt; &lt;!-- HTML5 section tag for the portfolio 'section' --&gt;
	&lt;/section&gt;

	&lt;section id="about"&gt; &lt;!-- HTML5 section tag for the about 'section' --&gt;
	&lt;/section&gt;

	&lt;section id="contact"&gt; &lt;!-- HTML5 section tag for the contact 'section' --&gt;
	&lt;/section&gt;

	&lt;footer&gt; &lt;!-- HTML5 footer tag --&gt;
	&lt;/footer&gt;	

&lt;/section&gt;</code></pre>
<h4>Header</h4>
<p>The first one you&#8217;ll notice is <strong>&lt;header&gt;</strong> and it does exactly what it implies. You can use this for the header of your page, typically containing the logo and the navigation.</p>
<blockquote><p>The header element represents a group of introductory or navigational aids.</p>
<p>A header element is intended to usually contain the section&#8217;s heading (an h1–h6 element or an hgroup element), but this is not required. The header element can also be used to wrap a section&#8217;s table of contents, a search form, or any relevant logos.</p></blockquote>
<p>The <a href="http://dev.w3.org/html5/spec/Overview.html#the-header-element">header</a> element as described in the HTML5 specs.</p>
<h4>Nav</h4>
<p>The <strong>&lt;nav&gt;</strong> tag now gives us the ability to highlight the navigation of a site through the HTML. Usually contained within the header of a page but can also be applied to left or right sided navigation in sidebars.</p>
<blockquote><p>The nav element represents a section of a page that links to other pages or to parts within the page: a section with navigation links.</p>
<p>Not all groups of links on a page need to be in a nav element — only sections that consist of major navigation blocks are appropriate for the nav element. In particular, it is common for footers to have a short list of links to various pages of a site, such as the terms of service, the home page, and a copyright page. The footer element alone is sufficient for such cases, without a nav element.</p>
<p>User agents (such as screen readers) that are targeted at users who can benefit from navigation information being omitted in the initial rendering, or who can benefit from navigation information being immediately available, can use this element as a way to determine what content on the page to initially skip and/or provide on request.</p></blockquote>
<p>The <a href="http://dev.w3.org/html5/spec/Overview.html#the-nav-element">nav</a> element as described in the HTML5 specs</p>
<h4>Section</h4>
<p>In this example the <strong>&lt;section&gt;</strong> tag is being used to separate the different parts of the page. The introduction, my portfolio, about me and contact me areas are all sections that make up the page, all contained within a section tag.</p>
<blockquote><p>The section element represents a generic document or application section. A section, in this context, is a thematic grouping of content, typically with a heading.</p>
<p>Examples of sections would be chapters, the various tabbed pages in a tabbed dialog box, or the numbered sections of a thesis. A Web site&#8217;s home page could be split into sections for an introduction, news items, contact information.</p></blockquote>
<p>The <a href="http://dev.w3.org/html5/spec/Overview.html#the-section-element">section</a> element as described in the HTML5 specs.</p>
<h4>Footer</h4>
<p>You&#8217;ll find the <strong>&lt;footer&gt;</strong> tag at the end of the contact section of the portfolio example. It&#8217;s included there and not at the end of the document in this case because it contains content relevant to the contact section in the form of the <a href="http://twitter.com/tkenny">Twitter link</a> (ignoring the back to tutorial link). For more information read the following included in the HTML 5 spec overview:</p>
<blockquote><p>The footer element represents a footer for its nearest ancestor sectioning content or sectioning root element. A footer typically contains information about its section such as who wrote it, links to related documents, copyright data, and the like.</p>
<p>Contact information for the author or editor of a section belongs in an address element, possibly itself inside a footer.</p>
<p>Footers don&#8217;t necessarily have to appear at the end of a section, though they usually do.</p>
<p>When the footer element contains entire sections, they represent appendices, indexes, long colophons, verbose license agreements, and other such content.</p>
<p>The footer element is not sectioning content; it doesn&#8217;t introduce a new section.</p>
<p>When the nearest ancestor sectioning content or sectioning root element is the body element, then it applies to the whole page.</p></blockquote>
<p>The <a href="http://dev.w3.org/html5/spec/Overview.html#the-footer-element">footer</a> element as described in the HTML5 specs.</p>
<h4>The Form</h4>
<p>While the form itself doesn&#8217;t seem to be radically different to previous methods, HTML5 does introduce a nice addition in the placeholder <strong>attribute</strong>. Basically this fills in a text field with sample text much like we&#8217;re used to doing with Javascript now.</p>
<pre><code class="html"><span>&lt;input placeholder="<a class="linkifyplus" href="mailto:example@domain.com">example@domain.com</a>" /&gt;</span></code></pre>
<p>For more on HTML5 in forms make sure you check out <a href="http://24ways.org/2009/have-a-field-day-with-html5-forms">Have a Field Day with HTML5 Forms</a> on last year&#8217;s 24 ways.</p>
<h3>Backwards Compatibility</h3>
<p>All of this is great. We&#8217;re using the latest and greatest technology in web development but currently only a few browsers support HTML5 in any capacity. We now need to think about all versions of Internet Explorer which don&#8217;t include any support for HTML5 whatsoever. Fortunately for us, Remy Sharp has created a <a href="http://remysharp.com/2009/01/07/html5-enabling-script/">Javascript file</a> that reverses IE&#8217;s inability to style elements it doesn&#8217;t recognise.</p>
<p>Just included the following code:</p>
<pre><code><span>&lt;!--[if IE]&gt;
&lt;script src="<a class="linkifyplus" href="http://html5shiv.googlecode.com/svn/trunk/html5.js">http://html5shiv.googlecode.com/svn/trunk/html5.js</a>"&gt;&lt;/script&gt;
&lt;![endif]--&gt;</span></code></pre>
<p>Now that all major browsers will recognise the styling let&#8217;s move onto the CSS.</p>
<h3>The CSS3 Goodness</h3>
<p>Most of the CSS won&#8217;t be new to you but there are a few CSS3 properties that we&#8217;ll have a look at including gradients, embeddable fonts and text shadow.</p>
<p><a href="http://inspectelement.com/html5portfolio/style.css">View the CSS here</a></p>
<p>Let&#8217;s begin by looking at how this page behaves visually in a browser that supports CSS3. <a href="http://inspectelement.com/html5portfolio/">View the demo</a> in the latest versions of Safari, Chrome or Firefox to see the full effect. Or see the screenshots below:</p>
<p><img class="alignnone size-full wp-image-6375" title="logo" src="http://inspectelement.com/wp-content/uploads/2010/01/logo.jpg" alt="" width="401" height="115" /></p>
<p><img class="alignnone size-full wp-image-6373" title="about" src="http://inspectelement.com/wp-content/uploads/2010/01/about.jpg" alt="" width="523" height="334" /></p>
<p><img class="alignnone size-full wp-image-6374" title="form" src="http://inspectelement.com/wp-content/uploads/2010/01/form.jpg" alt="" width="471" height="250" /></p>
<h4>@font-face</h4>
<p>While this example uses @font-face on every instance of text, I wouldn&#8217;t recommend doing so on large websites. Also, using some fonts as body text may case text to become hard to read. Don&#8217;t get carried away. This theme uses <a href="http://www.yanone.de/typedesign/kaffeesatz/">Yanone Kaffeesatz</a> at a large enough size to make it very readable and differ enough from the regular web-safe fonts.</p>
<pre><code>@font-face { font-family: Keffeesatz; src: url(YanoneKaffeesatz-Light.otf) format("opentype") }
@font-face { font-family: KeffeesatzBold; src: url(YanoneKaffeesatz-Bold.otf) format("opentype") }</code></pre>
<h4>RGBa</h4>
<p>With RGBa you can declare a colour and an opacity as a single property. Not only that but it can be applied to anything that uses colour. To demonstrate this, the image link and input borders have RGBa applied. You can see the subtle background texture show through, especially noticeable on the input elements in the form.</p>
<pre><code>input[type="text"] { border: 5px solid rgba(122, 192, 0, 0.15); }</code></pre>
<p>The first three values (122, 192, 0) are the red, green and blue values of the colour with the fourth (0.15) being the alpha value, or opacity.</p>
<p>Where it can be seen in the example:</p>
<ul>
<li>Logo (subtle border top and bottom)</li>
<li>Image link borders</li>
<li>Input borders</li>
</ul>
<h4>Gradients</h4>
<p>WebKit started the support of CSS gradients and Mozilla have followed suit and implement a slightly different way of generating them but support is there. Make sure to set a standard background colour for browsers that don&#8217;t support RGBa. The example below shows a linear gradient going from bottom-to-top.</p>
<pre><code>h1 a {
background: -webkit-gradient(
    linear,
    left bottom,
    left top,
    color-stop(0.23, #c34000),
    color-stop(0.62, #ff5400)
);
background: -moz-linear-gradient(
    center bottom,
    #c34000 23%,
    #ff5400 62%
);
}</code></pre>
<p>Where it can be seen in the example:</p>
<ul>
<li>Logo</li>
<li>Button</li>
</ul>
<h4>Text-Shadow</h4>
<p>A great addition to CSS3 used in the one page portfolio to add a touch of depth to the text on the page lifting it slightly from the patterned background.</p>
<pre><code>body { text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.2); }</code></pre>
<p>The first value is the horizontal distance, the second the vertical and the third how much blur is applied. The fourth value here is the previously mentioned RGBa. Both WebKit and firefox recognise the single declaration above which is nice.</p>
<p>Where it can be seen in the example:</p>
<ul>
<li>Everywhere (expect input text and)</li>
</ul>
<h4>Box-Shadow</h4>
<p>Be aware that the box-shadow CSS3 property has been <a href="http://www.w3.org/blog/CSS/2009/10/01/resolutions_79">dropped</a> from the CSS3 specs for now but it still works fine in WebKit and the latest versions of Firefox.</p>
<pre><code>header {
-webkit-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4);
}</code></pre>
<p>Where it can be seen in the example:</p>
<ul>
<li>Logo</li>
<li>Header</li>
<li>Hovering over image links</li>
<li>Hovering over input fields</li>
<li>Form button</li>
</ul>
<h4>Border-Radius</h4>
<p>Probably the most used CSS3 property in the wild right now and very simply implemented as the code shows below:</p>
<pre><code>h1 a {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}</code></pre>
<p>Where it can be seen in the example:</p>
<ul>
<li>Logo</li>
<li>Button</li>
<li>Borders that use RGBa in WebKit</li>
</ul>
<h4>Selection Colour</h4>
<p>Briefly <a href="http://inspectelement.com/didyouknow/change-the-browser-default-selection-appearance/">covered on Inspect Element before</a>, CSS3 gives us the ability to change the colour or background colour, or both, of selected text with the following code:</p>
<pre><code>::selection { background-color: rgba(122, 192, 0, 0.2); }
::-moz-selection { background-color: rgba(122, 192, 0, 0.2); }</code></pre>
<h3>So then, Internet Explorer&#8230;</h3>
<p>Let&#8217;s have a look at how this looks in our good old friend, Internet Explorer:</p>
<p><img class="alignnone size-full wp-image-6409" title="IE_html5portfolio" src="http://inspectelement.com/wp-content/uploads/2010/01/IE_html5portfolio.jpg" alt="" width="555" height="444" /></p>
<p><img class="alignnone size-full wp-image-6408" title="IE_contact" src="http://inspectelement.com/wp-content/uploads/2010/01/IE_contact.jpg" alt="" width="555" height="444" /></p>
<p>As you can see it doesn&#8217;t look quite as good as intended but it still looks really good. Don&#8217;t forget that the average visitor looking at sites in Internet Explorer typically don&#8217;t open it up in different browsers and compare the two so they&#8217;re none the wiser. It&#8217;s still perfectly readable and usable.</p>
<p>The possible exception is the logo, where you may want to save it as an image so it displays 100% as intended in all browsers.</p>
<h3>jQuery</h3>
<p>This extremely <a href="http://www.position-absolute.com/articles/better-html-anchor-a-jquery-script-to-slide-the-scrollbar/">simple method</a> of smooth scrolling using jQuery is used and makes navigation much more interesting.</p>
<h3>Can I have the .psd File please?</h3>
<p>You may be wondering where the Photoshop or Fireworks file is. Well, there isn&#8217;t one. This is a result of designing in the browser and shows what can be achieved when skipping the Photoshop design phase, saving a lot of time in the process.</p>
<p style="font-size: 24px;"><a style="font-size: 24px;" href="http://inspectelement.com/html5portfolio/">View Demo</a> | <a style="font-size: 24px;" href="http://inspectelement.com/html5portfolio/HTML5_portfolio.zip">Download Files (.zip)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://inspectelement.com/tutorials/code-a-backwards-compatible-one-page-portfolio-with-html5-and-css3/feed/</wfw:commentRss>
		<slash:comments>51</slash:comments>
		</item>
		<item>
		<title>How to Create a Theme Development Environment for a Live WordPress Site</title>
		<link>http://inspectelement.com/tutorials/create-a-wordpress-theme-development-environment/</link>
		<comments>http://inspectelement.com/tutorials/create-a-wordpress-theme-development-environment/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 09:44:31 +0000</pubDate>
		<dc:creator>Tom Kenny</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://inspectelement.com/?p=5872</guid>
		<description><![CDATA[Any good website owner knows that they need to be constantly looking at ways to improve their site even through small little tweaks. If you're using <strong>Wordpress</strong> you'll notice that it isn't easy to create a development version without creating a separate installation. Of course, you can make changes directly on a live WordPress site but that isn't recommended for anything other than minor tweaks.]]></description>
			<content:encoded><![CDATA[<p>Any good website owner knows that they need to be constantly looking at ways to improve their site even through small little tweaks. If you&#8217;re using <strong>WordPress</strong> you&#8217;ll notice that it isn&#8217;t easy to create a development version without creating a separate installation. Of course, you can make changes directly on a live WordPress site but that isn&#8217;t recommended for anything other than minor tweaks.</p>
<p><img class="alignnone size-full wp-image-6027" title="themeDevEnvironment" src="http://inspectelement.com/wp-content/uploads/2010/01/themeDevEnvironment3.jpg" alt="" width="555" height="216" /></p>
<p>With the help of an excellent plugin for WordPress called <a href="http://www.nkuttler.de/wordpress/theme-switch-and-preview-plugin/">Theme switch and preview</a>, this tutorial will allow you to easily switch between the live site and development versions using two different themes on the same installation of WordPress. We&#8217;ll do this by creating a bar at the top of the page which will clearly show you if you&#8217;re viewing the live theme (what everyone else sees) or the development theme with a link to switch between the two.</p>
<p>While there may well be a Worpdress plugin that does everything below, it&#8217;s much more rewarding and satisfying to create your own solution.</p>
<p><span id="more-5872"></span><strong> </strong></p>
<h3><strong>Step 1: Install Theme Switcher WordPress Plugin</strong></h3>
<p>First step is to install the aforementioned plugin, <a href="http://wordpress.org/extend/plugins/theme-switcher/">Theme switch and preview</a>. You can access the configuration for Theme Switcher in the settings section of the WordPress admin sidebar on the left where you can also find a list of all the available themes.</p>
<div id="attachment_5887" class="wp-caption alignnone" style="width: 557px"><img class="size-full wp-image-5887" title="themes" src="http://inspectelement.com/wp-content/uploads/2010/01/themes.gif" alt="" width="547" height="58" /><p class="wp-caption-text">Screenshot of the themes installed on Inspect Element as seen in Theme Switcher&#39;s settings.</p></div>
<p>By clicking any of the links above, you can switch between themes without activation allowing you to see what a different theme looks like without affecting what your visitors sees. They will still see the activated theme.</p>
<h3><strong>Step 2: Create a Copy of the Current Theme</strong></h3>
<p>This is as easy as just duplicating the theme folder in you WordPress theme directory. Make sure to change the name of the theme as it is what Theme Switcher relies on to distinguish between installed themes.</p>
<p><img class="alignnone size-full wp-image-5890" title="themeName" src="http://inspectelement.com/wp-content/uploads/2010/01/themeName.gif" alt="" width="337" height="130" /></p>
<p>You can see from the screenshots above that Theme Switcher uses the &#8216;Theme Name&#8217; but WordPress also picks up on this in the Themes section of the admin area so it&#8217;s a good practice to stick to with for any theme. Here I&#8217;ve added dev in brackets to use for my development theme.</p>
<h3>Step 3: Add the Dev Bar to the Live Theme</h3>
<p>One of the best ways to indicate what theme you&#8217;re viewing is to add a colour coded bar at the top of the page when logged in. We need to use a bit of PHP to determine if you&#8217;re logged in. Open up the <strong>header.php</strong> file in your live theme and paste in the following code directly below the <em>&lt;body&gt;</em> tag.</p>
<pre><code>&lt;?php if ( is_user_logged_in() ) : ?&gt;

 	// Insert dev bar code here

&lt;?php else : ?&gt;

	// Nothing here

&lt;?php endif; ?&gt;</code></pre>
<p>So that&#8217;s a simple bit of WordPress PHP to see if you&#8217;re logged in or not expressed as an if else statement. Of course you&#8217;ll want to include some HTML for the bar itself. We&#8217;re going to insert a div and a link to the dev version as well as a title.</p>
<pre><code class="php">&lt;?php if ( is_user_logged_in() ) : ?&gt;

	&lt;div id="devbar" class="live"&gt;

		&lt;p&gt;Live Site&lt;/p&gt;

		&lt;a href="&lt;?php pageURL(); ?&gt;?theme=Inspect+Element+v3+%28dev%29"&gt;Switch to Dev&lt;/a&gt;

	&lt;/div&gt;

&lt;?php else : ?&gt;

	// Nothing here

&lt;?php endif; ?&gt;</code></pre>
<p>For the link to the dev theme, you need to go back to the settings page for the Theme Switcher plugin and copy the link your development theme. This is the link you&#8217;ll use in your live dev bar. There&#8217;s one small amendment to make here. Replace everything before the <em>?theme=</em> with a function that gets the current url so that you&#8217;ll remain on the same page when switching between themes.</p>
<p>For this to work, you need to open up the <strong>functions.php</strong> file in your live theme and paste in the following code:</p>
<pre><code>function pageURL() {
    $pageURL = 'http';
     if ($_SERVER["HTTPS"] == "on") {
        $pageURL .= "s";
    }
     $pageURL .= "://";
     if ($_SERVER["SERVER_PORT"] != "80") {
          $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
     }
    else {
          $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
     }</code></pre>
<p>Source: <a href="http://www.kisaso.com/how-to-get-the-current-url-of-web-page-in-php/">How to get the current URL of web page in PHP</a> (Note: I&#8217;ve changed the name of the function from <em>kish_trans_curPageUR</em>L to <em>pageURL </em>to keep things simple.)</p>
<h3>Step 4: Add the Dev Bar to the Development Theme</h3>
<p>Follow the same as above but this time insert the code into the development theme files. Also you&#8217;ll need to modify the code in the link on the <strong>header.php</strong> to go back to the live version.</p>
<pre><code class="php">&lt;?php if ( is_user_logged_in() ) : ?&gt;

	&lt;div id="devbar" class="dev"&gt;

		&lt;p&gt;Development Site&lt;/p&gt;

		&lt;a href="&lt;?php pageURL(); ?&gt;?theme=Inspect+Element+v3"&gt;Switch to Live&lt;/a&gt;

	&lt;/div&gt;

&lt;?php else : ?&gt;

	// Nothing here

&lt;?php endif; ?&gt;</code></pre>
<h3>Step 5: Style the Dev Bar</h3>
<p>Obviously you have free reign to do what you want here with any CSS you want with any code you&#8217;ve chosen to use for the dev bar. We&#8217;re going to give the dev bar a red background and make it span the width of the browser.</p>
<pre><code class="css">#devbar.live { background-color: red; width: 100%; height 50px; }</code></pre>
<p>Now you&#8217;ll want to make the bar on the live site look different to the development site so that you know which one you&#8217;re on at a quick glance.</p>
<pre><code class="css">#devbar.dev { background-color: green; width: 100%; height 50px; }</code></pre>
<p>Place these in the respective CSS files for the live theme and the development theme.</p>
<h4>Additional Styling</h4>
<p>Something that I like to do is to use the &#8216;logged-in&#8217; class that WordPress appends to the body tag when you&#8217;re logged in to add an extra visual guide for each theme.</p>
<p>In the live theme&#8217;s CSS, I&#8217;ve I like to add the following:</p>
<pre><code class="css">body.logged-in { border-left: 30px solid green; }</code></pre>
<p>And in the development theme&#8217;s CSS:</p>
<pre><code class="css">body.logged-in { border-left: 30px solid red; }</code></pre>
<p>This gives a big visual indicator of what theme you are currently viewing. If there is a big green bar on the left, you&#8217;re seeing what your visitors see and if the bar is red, you&#8217;re viewing the development version. This comes in very handy when you scroll down the page and can no longer see the dev bar.</p>
<p><a href="http://inspectelement.com/wp-content/uploads/2010/01/inspectElementLive.jpg"><img class="alignnone size-full wp-image-5987" title="inspectElementLiveSm" src="http://inspectelement.com/wp-content/uploads/2010/01/inspectElementLiveSm.jpg" alt="" width="555" height="132" /></a></p>
<p><a href="http://inspectelement.com/wp-content/uploads/2010/01/inspectElementDev.jpg"><img class="alignnone size-full wp-image-5986" title="inspectElementDevSm" src="http://inspectelement.com/wp-content/uploads/2010/01/inspectElementDevSm.jpg" alt="" width="555" height="132" /></a></p>
<p>The screenshots above (click for larger versions) show how I&#8217;ve implemented this into Inspect Element with the use of some extra CSS styling and a couple of icons.</p>
<h3>Step 6: Temporarily Hide the Dev Bar with jQuery</h3>
<p>There will be times where you want to see your site without the dev bar and border on the left just as people on the outside see it. The simplest way of achieving this is to use some basic jQuery. The following is code I&#8217;ve implemented to hide the dev bar and the border on the left when the paragraph (&#8216;Live Site&#8217; and &#8216;Development Site&#8217; text) of the dev bar is clicked.</p>
<pre><code>&lt;script type="text/javascript"&gt;

$(document).ready(function(){
	$("#devbar p").css('cursor','pointer').click(function () {
		$("#devbar").hide();
		$("body.logged-in").css('border','none');
	});
});

&lt;/script&gt;</code></pre>
<p>Simply put, this code hides the dev bar <em>and</em> removes the left border on the body when you click on the #devbar p element in the dev bar. You may consider adding a button dedicated to this function instead.</p>
<p>It&#8217;s best to place this within the code that determines if the dev bar should be shown as in step 3. That way it will only load when the dev bar code is available and not when it isn&#8217;t needed. Also, don&#8217;t forget you need to include the jQuery library if your site doesn&#8217;t already, or this part won&#8217;t work.</p>
<h4>Bring the Dev Bar back with Keyboard Shortcuts</h4>
<p>What if you want to bring the dev bar and left border back? It will return either when you refresh the page or navigate to another part of the site but we&#8217;ve hidden it with jQuery, so why not bring it back with some additional jQuery in the form of a keyboard shortcut.</p>
<p>The following code will hide the dev bar and remove the left border when the letter &#8216;N&#8217; is pressed and bring it back when pressing &#8216;Y&#8217;.</p>
<pre><code>&lt;script type="text/javascript"&gt;

	$(document).bind('keydown', function(evt) {
		switch(evt.which) {
			case 78:	// letter 'n'
				$("#devbar").hide();
				$("body.logged-in").css('border','none');
				break;
			case 89:	// letter 'y'
				$("#devbar").show();
				$("body.logged-in").css('border-left','30px solid #972324');
				break;
		}
	});

&lt;/script&gt;</code></pre>
<h3>Create Your Own</h3>
<p>Ideally this is meant for designers who run their own site or manage an existing client&#8217;s site through WordPress. I&#8217;ve only been using this for couple of days now and already it&#8217;s made a world of difference whenever I want to make any changes but need to test before making them live.</p>
]]></content:encoded>
			<wfw:commentRss>http://inspectelement.com/tutorials/create-a-wordpress-theme-development-environment/feed/</wfw:commentRss>
		<slash:comments>47</slash:comments>
		</item>
		<item>
		<title>Four Different Ways of Implementing Twitter on your Site</title>
		<link>http://inspectelement.com/tutorials/4-different-ways-of-implementing-twitter-on-your-site/</link>
		<comments>http://inspectelement.com/tutorials/4-different-ways-of-implementing-twitter-on-your-site/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 01:00:19 +0000</pubDate>
		<dc:creator>Tom Kenny</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://inspectelement.com/?p=3929</guid>
		<description><![CDATA[Twitter has become one of the most popular forms of social media in use on the web today and it has been widely adopted by web designers and developers alike. There are many ways of integrating Twitter onto your site. By integrating Twitter with your site, you can get a community discussing your brand or [...]]]></description>
			<content:encoded><![CDATA[<p>Twitter has become one of the most popular forms of social media in use on the web today and it has been widely adopted by web designers and developers alike. There are many ways of integrating Twitter onto your site.</p>
<p><img src="http://inspectelement.com/wp-content/uploads/2009/10/implementTwitter2.jpg" alt="" /></p>
<p>By integrating Twitter with your site, you can get a community discussing your brand or service which doubles up as a great way of promotion. Here is a look at some of the most useful and interesting methods to get you started.</p>
<p><span id="more-3929"></span><strong>1. Displaying Latest Tweets</strong></p>
<p>When showing off your latest tweets on your site, you are giving the user a glimpse as whether or not they should follow you. They will be more likely to click through to your twitter page and follow you if they like what you tweet and by giving them a sample of your micro-blogging content.</p>
<h4>Implementation</h4>
<p>One of the easiest ways to display your latest tweets on your website is to use Remy Sharp&#8217;s <a href="http://remysharp.com/2007/05/18/add-twitter-to-your-blog-step-by-step/">twitterjs</a>. Just include the following code just before the close body tag in your HTML.</p>
<pre><span>&lt;script src="<a class="linkifyplus" href="http://twitterjs.googlecode.com/svn/trunk/src/twitter.min.js">http://twitterjs.googlecode.com/svn/trunk/src/twitter.min.js</a>"&gt;&lt;/script&gt;
&lt;script type="text/javascript" charset="utf-8"&gt;
getTwitters('tweet', {
    id: 'username',
    count: 3,
    enableLinks: true,
    ignoreReplies: true,
    clearContents: true,
    template: '"%text%" &lt;a href="<a class="linkifyplus" href="http://twitter.com/%user_screen_name%/statuses/%id%/">http://twitter.com/%user_screen_name%/statuses/%id%/</a>"&gt;%time%&lt;/a&gt;'
});
&lt;/script&gt;</span></pre>
<p>Placing it at the bottom allows your site to load before Twitter does. Very handy, as if (or should that be when?) Twitter is down it won&#8217;t affect the loading of the rest of your site.</p>
<p><strong>NOTE: </strong>The example code below links to the script on Google&#8217;s server. You can download it and host it on your own server if you wish.</p>
<p>Change the &#8216;id&#8217; to your Twitter username and the &#8216;count&#8217; number for the number of latest tweets to display. You can also choose to ignore @replies which could confuse readers as it will only display one half of a conversation.</p>
<p>Then, you need to include the following line of code wherever you want your tweets to appear on your page.</p>
<pre>&lt;div id="tweet"&gt;&lt;/div&gt;</pre>
<p>Finally, the script renders your tweets out as an unordered list with span tags separating out different elements of tweets such as the time of tweet making it very simple to style through CSS.</p>
<h4>Examples of Latest Tweet Displays</h4>
<p><a href="http://yodaa.com/"><img class="alignnone size-full wp-image-3937" title="yodaa" src="http://inspectelement.com/wp-content/uploads/2009/10/yodaa.jpg" alt="yodaa" width="560" height="300" /></a></p>
<p><a href="http://www.friml.com/"><img class="alignnone size-full wp-image-3944" title="friml" src="http://inspectelement.com/wp-content/uploads/2009/10/friml.jpg" alt="friml" width="560" height="142" /></a></p>
<p><a href="http://www.poonut.com/"><img class="alignnone size-full wp-image-3939" title="peanut" src="http://inspectelement.com/wp-content/uploads/2009/10/peanut.jpg" alt="peanut" width="560" height="151" /></a></p>
<p><a href="http://maustingraphics.com/"><img class="alignnone size-full wp-image-3935" title="maustingraphics" src="http://inspectelement.com/wp-content/uploads/2009/10/maustingraphics.jpg" alt="maustingraphics" width="560" height="270" /></a></p>
<p><a href="http://revyver.com/"><img class="alignnone size-full wp-image-3936" title="revyver" src="http://inspectelement.com/wp-content/uploads/2009/10/revyver.gif" alt="revyver" width="560" height="204" /></a></p>
<p><a href="http://www.juliofragoso.com/"><img class="alignnone size-full wp-image-3931" title="juliofragoso" src="http://inspectelement.com/wp-content/uploads/2009/10/juliofragoso.jpg" alt="juliofragoso" width="560" height="260" /></a></p>
<h3>2. Displaying Favourite Tweets</h3>
<p>A feature of Twitter is the ability to &#8216;favourite&#8217; Tweets. Basically this bookmarks a tweet and adds it to your favourites page on Twitter. The simplest way of achieving this is by using <a href="http://simplepie.org/">SimplePie</a> becauseÂ allows you to display an RSS feed on any site.</p>
<p>Make sure you are logged in to your Twitter account at <a href="https://twitter.com/">Twitter.com</a> then navigate to your <a href="https://twitter.com/#favorites">favourites</a>. While there is no link to an RSS feed anywhere on the page itself, browsers pick up that there is an RSS feed for your favourites so check your favourite browser for a link to the RSS. Safari and Firefox both display an RSS button beside the URL.</p>
<div id="attachment_4016" class="wp-caption alignnone" style="width: 284px"><img class="size-full wp-image-4016" title="rssButtons" src="http://inspectelement.com/wp-content/uploads/2009/10/rssButtons.gif" alt="rssButtons" width="274" height="37" /><p class="wp-caption-text">Safari and Firefox&#39;s RSS buttons</p></div>
<p>So for example, my Twitter favourites feed is:</p>
<pre><span>feed:<a class="linkifyplus" href="https://twitter.com/favorites/12633712.rss">https://twitter.com/favorites/12633712.rss</a></span></pre>
<h4>Implementation:</h4>
<p>As for integrating it into your site withÂ <a href="http://simplepie.org/">SimplePie</a>, I won&#8217;t reinvent the wheel here as Chris Coyier has done a superb job of <a href="http://css-tricks.com/video-screencasts/55-adding-rss-content-with-simplepie/">running through this in a screencast over on his site, CSS-Tricks</a>.</p>
<p>This method will also render out the tweets in your HTML semantically as an unordered list.</p>
<h3>3. Tweet this/Retweet Button</h3>
<p>John Resig, the creator jQuery, has developed a simple way of tweeting the current page URL and title while also displaying a number of the amount of times that particular page has been tweeted. You can see an example of this implementation here on Inspect Element at the top of the page and in the share links immediately after the article.</p>
<h4>Implementation:</h4>
<p>Only a couple of lines of code are need for this. First you need to include the javascript file in the header of your site with the following code.</p>
<p><strong>NOTE</strong>: Again, if you want to host the file on your own server, make sure that you download it and link to that instead.</p>
<pre><span>&lt;script src="<a class="linkifyplus" href="http://ejohn.org/files/retweet.js">http://ejohn.org/files/retweet.js</a>"&gt;&lt;/script&gt;</span></pre>
<p>Then include HTML as below:</p>
<pre>&lt;a class="retweet self"&gt;&lt;/a&gt;</pre>
<p>The class of &#8216;self&#8217; will automatically tweet the title of the page with a short, bit.ly URL link such as this:</p>
<blockquote><p>RT @<a href="https://twitter.com/tkenny">tkenny</a> Making the Most of Icons in Web Design &#8211; Inspect Element <a href="http://bit.ly/rc1rD">http://bit.ly/rc1rD</a></p></blockquote>
<p>Make sure you check out John&#8217;s post about the <a href="http://ejohn.org/blog/retweet/">Easy Retweet Button</a> to see all of the options for customisation.</p>
<p>With the sharing nature of Twitter users in the web design and development industry, as well as Twitter as a whole, this gives the reader/user a quick way of sharing what they like with their followers.</p>
<h3>4. Display a Twitter Discussion</h3>
<p>On the right hand side of this page you will see a section titled Twitter Activity. Anytime someone tweets the words &#8216;Inspect Element&#8217;, it automatically gets displayed in that section.</p>
<div id="attachment_3984" class="wp-caption alignnone" style="width: 395px"><img class="size-full wp-image-3984" title="twitterActivity" src="http://inspectelement.com/wp-content/uploads/2009/10/twitterActivity.gif" alt="Twitter Activity section finds any tweet that mentions Inspect Element" width="385" height="419" /><p class="wp-caption-text">Twitter Activity section finds any tweet that mentions Inspect Element</p></div>
<p>This is great because it allows me to see who mentions anything about the blog and see what people are saying.</p>
<h4>Implementation</h4>
<p>It is performed with the help of a jQuery plugin called <a href="http://juitter.com/">Juitter</a>.</p>
<p>As with all jQuery plugins make sure you include a reference to the javascript file in your header below the reference to the actual jQuery file itself.</p>
<pre>&lt;script language="javascript" src="/yourlocation/jquery.juitter.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script language="javascript" src="/yourlocation/system.js" type="text/javascript"&gt;&lt;/script&gt;</pre>
<p>Much like the previous examples, include the a single line of HTML code anywhere you want it to appear.</p>
<pre>&lt;div id="juitterContainer"&gt;&lt;/div&gt;</pre>
<p>Likewise, the code that comes back is nice to work with.</p>
<div id="attachment_3985" class="wp-caption alignnone" style="width: 518px"><img class="size-full wp-image-3985" title="juitterCode" src="http://inspectelement.com/wp-content/uploads/2009/10/juitterCode.gif" alt="juitterCode" width="508" height="217" /><p class="wp-caption-text">Juitter churns out some nice semantic HTML</p></div>
]]></content:encoded>
			<wfw:commentRss>http://inspectelement.com/tutorials/4-different-ways-of-implementing-twitter-on-your-site/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Advanced Photoshop Techniques that you may not be aware of</title>
		<link>http://inspectelement.com/tutorials/advanced-photoshop-techniques-that-you-may-not-be-aware-of/</link>
		<comments>http://inspectelement.com/tutorials/advanced-photoshop-techniques-that-you-may-not-be-aware-of/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 21:02:59 +0000</pubDate>
		<dc:creator>Tom Kenny</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[photoshop]]></category>

		<guid isPermaLink="false">http://inspectelement.com/?p=3787</guid>
		<description><![CDATA[Photoshop is one of the most widely tools used for web design. Most web designers don't use all of the great things that Photoshop can do. It's easy to get stuck in your ways but instead you should be looking to further improve your skills and learn new techniques to improve your web design work, work flow and productivity.]]></description>
			<content:encoded><![CDATA[<p><strong>Photoshop</strong> is one of the most widely tools used for <strong>web design</strong>. Most web designers don&#8217;t use all of the great things that Photoshop can do. It&#8217;s easy to get stuck in your ways but instead you should be looking to <strong>further improve your skills</strong> and <strong>learn new techniques</strong> to improve your web design work, work flow and productivity.</p>
<p><img src="http://inspectelement.com/wp-content/uploads/2009/10/adpstech.jpg" alt="" /></p>
<p>The following are <strong>advanced Photoshop techniques</strong> that can help with your day to day use of Photoshop.<span id="more-3787"></span><strong>Convert Layer Styles into their own Layers</strong></p>
<p>Sometimes you will want to have more control over layer styles. The good news is that you can. Take this example of a New Zealand map which has an outer glow and a stroke applied as layer styles.</p>
<p><img class="alignnone size-full wp-image-3864" title="new_zealand_layerstyles" src="http://inspectelement.com/wp-content/uploads/2009/10/new_zealand_layerstyles.jpg" alt="new_zealand_layerstyles" width="540" height="524" /></p>
<p>If you select a layer that has layer styles applied to it, you can navigate to <em>Layer &gt; Layer Style &gt; Create Layers</em> which will create separate layers for each of your layer styles. As you can see below, the map has been separated into its original later, the stroke layer and the outer glow.</p>
<p><img class="alignnone size-full wp-image-3865" title="new_zealand_layerstyleslayers" src="http://inspectelement.com/wp-content/uploads/2009/10/new_zealand_layerstyleslayers.jpg" alt="new_zealand_layerstyleslayers" width="540" height="524" /></p>
<p>You can now edit these layers on their own just like any other.</p>
<h3><strong>Batch Action Processing</strong></h3>
<p>Actions are a great way of automating a repetitive task but what if you need to apply the same action to many files? Sure, you can do them one by one but of course this is time consuming if you have to apply it to many files.</p>
<p>Luckily Photoshop can do this for you. Go to <em>File &gt; Automate &gt; Batch&#8230;</em> in Photoshop which will bring up the following dialog box.</p>
<div id="attachment_3881" class="wp-caption alignnone" style="width: 418px"><img class="size-full wp-image-3881" title="batchactions" src="http://inspectelement.com/wp-content/uploads/2009/10/batchactions.gif" alt="batchactions" width="408" height="570" /><p class="wp-caption-text">Automate batch actions.</p></div>
<p>The best thing to do is to place all the images you want into a folder and then choose that folder as the source. You can then choose a destination and filename formatting.</p>
<p>Remember you can even use this as a simple operations such as saving a batch of files of one format into another.</p>
<h3>Cutting Out Images with the Help of Calculations</h3>
<p>Here is a quick tip for cutting out objects from images. If there is a decent amount of contrast between the object and the surrounding area or background then we can use a Photoshop feature called calculations to cut the object out very quickly.</p>
<p>This image will work well for this method.</p>
<p><img class="alignnone size-full wp-image-3818" title="plane" src="http://inspectelement.com/wp-content/uploads/2009/10/plane.jpg" alt="plane" width="560" height="373" /></p>
<p>View the channels panel to see the red, green and blue channels.</p>
<div id="attachment_3819" class="wp-caption alignnone" style="width: 260px"><img class="size-full wp-image-3819" title="channels" src="http://inspectelement.com/wp-content/uploads/2009/10/channels.jpg" alt="channels" width="250" height="191" /><p class="wp-caption-text">Channels panel</p></div>
<p>Calculations in Photoshop is a way of combining two different channels into one so now we need to work out which two together will give us the most black (plane) against white (the sky). We will then turn the end result into an alpha channel to create a selection.</p>
<p>To begin using calculations go to <em>Image &gt; Calculations&#8230; </em>and you will see the following options.</p>
<div id="attachment_3887" class="wp-caption alignnone" style="width: 546px"><img class="size-full wp-image-3887" title="calculations" src="http://inspectelement.com/wp-content/uploads/2009/10/calculations.gif" alt="calculations" width="536" height="400" /><p class="wp-caption-text">Photoshop&#39;s calculations dialog box.</p></div>
<p>In this case, the green and blue channels combined together give the best result.</p>
<p><img class="alignnone size-full wp-image-3820" title="bluegreen" src="http://inspectelement.com/wp-content/uploads/2009/10/bluegreen.jpg" alt="bluegreen" width="560" height="373" /></p>
<p>At this point a new channel will have been created. This is the alpha channel but it&#8217;s not perfect. We need to create the maximum contrast of black against white to create the perfect selection. We do this by changing the values of black and white using levels (keyboard shortcut: ctrl or cmd + L). The key is to remove as much grey as possible without destroying the outline of the object in the image. Also, use the brush tool in white to brush out the ground layer.</p>
<p><img class="alignnone size-full wp-image-3821" title="levels" src="http://inspectelement.com/wp-content/uploads/2009/10/levels.jpg" alt="levels" width="560" height="612" /></p>
<p>Once you&#8217;re happy, hold CTRL (CMD on Mac) and click on the alpha channel to make the selection. Head back into the layers panel and invert the selection (CTRL/CMD + Shift + I). Now apply this as a layer mask and you will only see the plane remaining.</p>
<p>Now we can move the plane onto a different image.</p>
<p><img class="alignnone size-full wp-image-3817" title="planefinal" src="http://inspectelement.com/wp-content/uploads/2009/10/planefinal.jpg" alt="planefinal" width="560" height="218" /></p>
<p>While this works well on a light background such as the blue sky, below you can see that it doesn&#8217;t work so well on a dark background.</p>
<p><img class="alignnone size-full wp-image-3822" title="darkbg" src="http://inspectelement.com/wp-content/uploads/2009/10/darkbg.jpg" alt="darkbg" width="560" height="218" /></p>
<p>There is a simple fix once again involving the levels tool but first, select the layer mask of the plane and apply <em>Filter &gt; Blur &gt; Blur </em>More twice. This creates varying levels of grey on the edge of the layer mask.</p>
<div id="attachment_3823" class="wp-caption alignnone" style="width: 442px"><img class="size-full wp-image-3823" title="grey" src="http://inspectelement.com/wp-content/uploads/2009/10/grey.jpg" alt="Blur the layer mask for greater control" width="432" height="325" /><p class="wp-caption-text">Blur the layer mask for greater control</p></div>
<p>With the layer mask still selected, use the levels tool to reduced the amount dark values which will contract the layer mask and hide the light outline.</p>
<p><img class="alignnone size-full wp-image-3827" title="finaldark" src="http://inspectelement.com/wp-content/uploads/2009/10/finaldark.jpg" alt="finaldark" width="560" height="218" /></p>
<p>It may need a bit of tweaking depending on the image but you saved a lot of time that would have been spent with the pen tool.</p>
<h3><span style="font-weight: normal;">Layer Comps</span></h3>
<p>Layer comps allow you to create different versions of the same layout in one Photoshop file, making it easier to manage multiple variations of page designs.</p>
<div id="attachment_3798" class="wp-caption alignnone" style="width: 264px"><img class="size-full wp-image-3798" title="layercompspanel" src="http://inspectelement.com/wp-content/uploads/2009/10/layercompspanel.gif" alt="layercompspanel" width="254" height="165" /><p class="wp-caption-text">Layer comps panel.</p></div>
<p>When creating a new layer comp, you can save the visibility, positions and layer styles of all layers. This means that layer comps will only remember theses values. Make sure that they&#8217;re all always ticked or you will come across problems with multiple layer comps.</p>
<div id="attachment_3805" class="wp-caption alignnone" style="width: 550px"><img class="alignnone size-full wp-image-3808" title="newlayercomp" src="http://inspectelement.com/wp-content/uploads/2009/10/newlayercomp1.gif" alt="newlayercomp" width="540" height="243" /><p class="wp-caption-text">New layer comp options</p></div>
<p>The final tip that makes this even more useful is the ability to save out each layer comp to its own file. Go to <em>File &gt; Scripts &gt; Layer Comps to Files&#8230;</em> which will bring up the following dialog box to save each layer comp out whatever file type you choose.</p>
<div id="attachment_3801" class="wp-caption alignnone" style="width: 462px"><img class="size-full wp-image-3801" title="savecomps" src="http://inspectelement.com/wp-content/uploads/2009/10/savecomps.gif" alt="savecomps" width="452" height="504" /><p class="wp-caption-text">Save all layer comps into their own files.</p></div>
<div id="attachment_3804" class="wp-caption alignnone" style="width: 550px"><img class="size-full wp-image-3804" title="layercomps" src="http://inspectelement.com/wp-content/uploads/2009/10/layercomps1.jpg" alt="layercomps" width="540" height="210" /><p class="wp-caption-text">Two different versions of the same layout in one .psd file using layer comps.</p></div>
<h3><span style="font-weight: normal;">Typography Keyboard Shortcuts</span></h3>
<p>Let&#8217;s face it, dealing with text in Photoshop is not exactly a pleasant experience. Luckily there are some keyboard shortcuts to ease the pain a little.</p>
<ul>
<li>Double click the <strong>T</strong> icon in the layers panel to select all text in that layer.</li>
<li>Commit text changes by pressing <strong>CTRL/CMD + Enter</strong>.</li>
<li>With text selected, hide the selection colour with <strong>CTRL/CMD + H</strong> to see an accurate preview of the text. Great when working with colour.</li>
<li><strong>CTRL/CMD + Shift + Left </strong>or <strong>Right</strong> arrow key selects the whole next or previous word.</li>
<li><strong>CTRL/CMD + Shift + &gt;</strong> to increase font-size by 2 points.</li>
<li><strong>CTRL/CMD + Shift + &lt;</strong> to decrease font-size by 2 points.</li>
<li><strong>CTRL/CMD + Shift + ALT/Option + &gt;</strong> to increase font-size by 10 points.</li>
<li><strong>CTRL/CMD + Shift + ALT/Option + &lt;</strong> to decrease font-size by 10 points.</li>
<li><strong>CTRL/CMD + ALT/Option +</strong> <strong>Left </strong>or <strong>Right </strong>arrow keys to increase or decrease kerning between letter by 100.</li>
<li><strong>ALT/Option +</strong> <strong>Left </strong>or <strong>Right </strong>arrow keys to increase or decrease kerning between letter by 20.</li>
<li><strong>CTRL/CMD + ALT/Option +</strong> <strong>Up </strong>or <strong>Down </strong>arrow keys to move the baseline up or down by 10.</li>
<li><strong>ALT/Option +</strong> <strong>Up </strong>or <strong>Down </strong>arrow keys to move the baseline up or down by 2.</li>
<li><strong>CTRL/CMD + Shift + L, R </strong>or<strong> C </strong>keys to align the paragraph of text left, right or centre.</li>
</ul>
<h3>Smart Filters</h3>
<p>Introduced in Photoshop CS3, smart filters give you great control when dealing with filters. All you have to do is select your desired layer and then <em>Filter &gt; Convert for Smart Filter</em>. Start applying filters and you will see that they appear below the layer name in the layers panel.</p>
<div id="attachment_3791" class="wp-caption alignnone" style="width: 254px"><img class="size-full wp-image-3791" title="smartfilters" src="http://inspectelement.com/wp-content/uploads/2009/10/smartfilters.gif" alt="smartfilters" width="244" height="185" /><p class="wp-caption-text">Smart filters in action</p></div>
<p>Now you can reorder them and double click to edit. The best thing is this is a non-destructive way of applying filters as you can delete them and return to the layer&#8217;s original state.</p>
<p>These are just some examples of advanced Photoshop techniques. We&#8217;ll be looking at more in the future but make sure you seek out some of your own. If you do find any, post them in the comments to share with other readers of Inspect Element.</p>
]]></content:encoded>
			<wfw:commentRss>http://inspectelement.com/tutorials/advanced-photoshop-techniques-that-you-may-not-be-aware-of/feed/</wfw:commentRss>
		<slash:comments>74</slash:comments>
		</item>
		<item>
		<title>How to Design Buttons to Help Improve Usability</title>
		<link>http://inspectelement.com/tutorials/how-to-design-buttons-to-help-improve-usability/</link>
		<comments>http://inspectelement.com/tutorials/how-to-design-buttons-to-help-improve-usability/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 22:31:37 +0000</pubDate>
		<dc:creator>Tom Kenny</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[buttons]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://inspectelement.com/?p=2839</guid>
		<description><![CDATA[Buttons can play a big part in how visitors interact with a website. They come in varying shapes, sizes and styles but there are a few things to consider when designing buttons: Use of Icons Look and Feel Behaviour Importance Consistency Use of Icons Using icons as part of buttons can help improve usability by [...]]]></description>
			<content:encoded><![CDATA[<p>Buttons can play a big part in how visitors interact with a website. They come in varying shapes, sizes and styles but there are a few things to consider when designing buttons:</p>
<ul>
<li>Use of Icons</li>
<li>Look and Feel</li>
<li>Behaviour</li>
<li>Importance</li>
<li>Consistency</li>
</ul>
<h3>Use of Icons</h3>
<p>Using icons as part of buttons can help improve usability by providing a visual aid making it more obvious to the user as to what function the button provides. Below are examples of buttons incorporating icons and shapes to do just that:</p>
<p><img class="alignnone size-full wp-image-2908" title="exampleButtons" src="http://inspectelement.com/wp-content/uploads/2009/09/exampleButtons.jpg" alt="exampleButtons" width="560" height="218" /></p>
<p><span id="more-2839"></span>One of the most common uses of icons in buttons is to include an arrow to indicate that the button guides you to the next or previous step or page.</p>
<p>Other common uses seen above are an up arrow for uploading, down arrow for downloading, play icon to for video playback and magnifying glass for search. As long as the icon makes sense and doesn&#8217;t confuse the user then icons can definitely have a positive impact on usability.</p>
<h3>Look and Feel</h3>
<p>The vast majority of buttons are wide and thin to accommodate one, two or three words of text. Now and again you will come across buttons that are square or bigger than usual. As long as it is clear that a button looks clickable and is clear in what it presents then it will certainly help improve usability.</p>
<p><img class="alignnone size-full wp-image-2913" title="variedButtons" src="http://inspectelement.com/wp-content/uploads/2009/09/variedButtons.jpg" alt="variedButtons" width="560" height="475" /></p>
<p>One of the biggest observations is the vast majority of buttons have rounded corners. Some bigger than others. This really is the typical style of a button. Using this as a standard when designing a button is a good place to start as it will be immediately familiar to the user that it is indeed a button.</p>
<h3>Behaviour</h3>
<p><img class="alignnone" title="Button Sprite" src="http://inspectelement.com/wp-content/themes/inspectelementv2/style/images/button.png" alt="" width="186" height="156" /></p>
<p>Here at Inspect Element, I&#8217;ve looked at <a href="http://inspectelement.com/tutorials/create-a-button-with-hover-and-active-states-using-css-sprites/">button behaviour before</a>. It is important that design of a button includes a hover and active state as it can go along way to conveying the appearance of a button.</p>
<h4>Physical Buttons</h4>
<p>Think of a physical button such as those on an mp3 player, television remote control or a computer keyboard. Essentially this is what a button in web design is emulating.</p>
<h4>Hover State</h4>
<p><img class="alignnone size-full wp-image-1461" title="button_hover" src="http://inspectelement.com/wp-content/uploads/2009/07/button_hover.png" alt="button_hover" width="186" height="52" /></p>
<p>With that in mind, the hover state is the closest interaction on the web can get to the sensation of touch. Physical buttons are usually raised so they are easily accessible to touch. Remembering this when designing a button, design a hover state to improve usability. Common techniques include changing the colour or making the original colour darker or lighter.</p>
<h4>Click State</h4>
<p><img class="alignnone size-full wp-image-1463" title="button_click" src="http://inspectelement.com/wp-content/uploads/2009/07/button_click.png" alt="button_click" width="186" height="52" /></p>
<p>Keeping the physical button metaphor, a click state also adds to the sensation of pressing a button. Again, make this different from the hover state so that the user knows they&#8217;ve clicked a button. A common way of achieving this is to use an inner shadow to give the impression of the button being &#8216;pushed&#8217; in.</p>
<h3>Importance</h3>
<p>The importance of a button will have an affect on the design. Using a different colour that grabs your attention is a good way of increasing the performance of a button. Increasing the size of the more important button(s) is also very effective.</p>
<p>As can be seen on the <a href="http://www.squarespace.com/">SquarespaceÂ homepage</a> it is obvious that they are encouraging visitors to try their service for free above taking the tour which is a much smaller and darker button underneath:</p>
<p><img class="alignnone size-full wp-image-2921" title="ssButtons" src="http://inspectelement.com/wp-content/uploads/2009/09/ssButtons1.jpg" alt="ssButtons" width="560" height="319" /></p>
<p>Over on the <a href="http://paramoreredd.com/">Paramore|Redd homepage</a> they clearly want you to sign up for enews more than anything else due to the size of the button, typography used and emphasis on the embedded icon:</p>
<p><img class="alignnone size-full wp-image-2922" title="pRedd" src="http://inspectelement.com/wp-content/uploads/2009/09/pRedd.jpg" alt="pRedd" width="560" height="156" /></p>
<p>Using the example of colour, <a href="http://www.postbox-inc.com/">Postbox</a>&#8216;s goal is to convert users to either download the free trial of their app or purchase a copy. The red buttons at the top of the page really catch the attention of the visitor:</p>
<p><img class="alignnone size-full wp-image-2926" title="postbox" src="http://inspectelement.com/wp-content/uploads/2009/09/postbox.jpg" alt="postbox" width="560" height="260" /></p>
<h3>Consistency</h3>
<p>It is important for all buttons on a site to retain a certain level of consistency or else you risk confusing the users into trying to work out what is or isn&#8217;t a button.</p>
<p>They shouldn&#8217;t have to work in order to find out what they can click on and what they can&#8217;t. The best buttons are the ones that integrate into the design and are obvious to the user what function they serve.</p>
<h3>Conclusion</h3>
<p>There is much more to think about button design other than just making them look pretty. Considering icons, colours, wording and behaviour too can go along way to improving the usability of your next web design. It is worth noting that it is one of the easier ways to do so and is often overlooked.</p>
]]></content:encoded>
			<wfw:commentRss>http://inspectelement.com/tutorials/how-to-design-buttons-to-help-improve-usability/feed/</wfw:commentRss>
		<slash:comments>60</slash:comments>
		</item>
		<item>
		<title>7 Very Simple Tips and Tricks for getting More out of WordPress</title>
		<link>http://inspectelement.com/tutorials/7-very-simple-tips-and-tricks-for-getting-more-out-of-wordpress/</link>
		<comments>http://inspectelement.com/tutorials/7-very-simple-tips-and-tricks-for-getting-more-out-of-wordpress/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 20:35:52 +0000</pubDate>
		<dc:creator>Tom Kenny</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://inspectelement.com/?p=2449</guid>
		<description><![CDATA[WordPress is a very powerful blogging and CMS tool but as with all content management systems it needs tweaking to meet certain needs. Here are seven things you can do to get more out of WordPress with very little effort.1. Use Page Templates for custom Page Layouts In the root of your theme folder in [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-2551" title="moreWordpress" src="http://inspectelement.com/wp-content/uploads/2009/08/moreWordpress1.jpg" alt="moreWordpress" width="560" height="218" /></p>
<p>WordPress is a very powerful blogging and CMS tool but as with all content management systems it needs tweaking to meet certain needs. Here are seven things you can do to get more out of WordPress with very little effort.<span id="more-2449"></span><strong>1. Use Page Templates for custom Page Layouts</strong></p>
<p>In the root of your theme folder in your WordPress install is a file called <em>page-custom.php. </em>Duplicate this and name it something relevant then change template name. Although this has been commented out, WordPress uses this as the name of the of the template which you will select later.</p>
<pre>&lt;?php
/*
Template Name: About
*/
?&gt;
&lt;?php get_header(); ?&gt;
&lt;?php get_footer(); ?&gt;</pre>
<p>Now place whatever code you want in between the header and footer tags. When editing a page you can now choose that page template to be used on that page.</p>
<div id="attachment_2503" class="wp-caption alignnone" style="width: 310px"><img class="size-full wp-image-2503" title="template" src="http://inspectelement.com/wp-content/uploads/2009/08/template1.gif" alt="Select a page template" width="300" height="141" /><p class="wp-caption-text">Select a page template</p></div>
<h3>2. Customise the Login Page</h3>
<p>Simply locate the <em>login.css</em> file in the CSS folder in wp-admin and make any changes you see fit. For example replace the WordPress logo with one ofÂ your own by editing the following code:</p>
<pre>h1 a {
	background: url(../images/logo-login.gif) no-repeat top center;
	width: 326px;
	height: 67px;
	text-indent: -9999px;
	overflow: hidden;
	padding-bottom: 15px;
	display: block;
}</pre>
<p>Make sure you keep a backup of any changes you make as they&#8217;ll be overwritten when you upgrade.</p>
<h3>3. Style Author Comments</h3>
<p>Styling author comments is extremely easy as it has been a feature since version 2.7. Simply target the list item with a class of <em>bypostauthor</em> with the following code in your CSS:</p>
<pre>li.bypostauthor { color: blue; }</pre>
<h3>4. Separate Comments and Trackbacks</h3>
<p>By default, WordPress display trackbacks in amongst comments. It looks messy and makes it hard for readers to follow the conversation.</p>
<p>Find this line in your <em>comments.php</em> file:</p>
<pre>&lt;?php foreach ($comments as $comment) : ?&gt;</pre>
<p>Place this code directly underneath:</p>
<pre>&lt;?php $comment_type = get_comment_type(); ?&gt;
&lt;?php if($comment_type == 'comment') { ?&gt;</pre>
<p>Now find the following line:</p>
<pre>&lt;?php endforeach; /* end for each comment */ ?&gt;</pre>
<p>Insert the following line directly above it:</p>
<pre>&lt;?php } else { $trackback = true; } /* End of is_comment statement */ ?&gt;</pre>
<p>This will display the comments all on their own. To display the trackbacks in their own section, locate this code:</p>
<pre>&lt;?php else : // this is displayed if there are no comments so far ?&gt;</pre>
<p>Paste the following above:</p>
<pre>&lt;?php if ($trackback == true) { ?&gt;<br style="list-style-type: none; list-style-position: initial; list-style-image: initial; padding: 0px; margin: 0px; border: initial none initial;" />&lt;h3&gt;Trackbacks&lt;/h3&gt;<br style="list-style-type: none; list-style-position: initial; list-style-image: initial; padding: 0px; margin: 0px; border: initial none initial;" />&lt;ol&gt;<br style="list-style-type: none; list-style-position: initial; list-style-image: initial; padding: 0px; margin: 0px; border: initial none initial;" />&lt;?php foreach ($comments as $comment) : ?&gt;<br style="list-style-type: none; list-style-position: initial; list-style-image: initial; padding: 0px; margin: 0px; border: initial none initial;" />&lt;?php $comment_type = get_comment_type(); ?&gt;<br style="list-style-type: none; list-style-position: initial; list-style-image: initial; padding: 0px; margin: 0px; border: initial none initial;" />&lt;?php if($comment_type != 'comment') { ?&gt;<br style="list-style-type: none; list-style-position: initial; list-style-image: initial; padding: 0px; margin: 0px; border: initial none initial;" />&lt;li&gt;&lt;?php comment_author_link() ?&gt;&lt;/li&gt;<br style="list-style-type: none; list-style-position: initial; list-style-image: initial; padding: 0px; margin: 0px; border: initial none initial;" />&lt;?php } ?&gt;<br style="list-style-type: none; list-style-position: initial; list-style-image: initial; padding: 0px; margin: 0px; border: initial none initial;" />&lt;?php endforeach; ?&gt;<br style="list-style-type: none; list-style-position: initial; list-style-image: initial; padding: 0px; margin: 0px; border: initial none initial;" />&lt;/ol&gt;<br style="list-style-type: none; list-style-position: initial; list-style-image: initial; padding: 0px; margin: 0px; border: initial none initial;" />&lt;?php } ?&gt;</pre>
<p>Now the trackbacks will appear below the comments in the form of an unordered list.</p>
<p>Source:</p>
<p><span><a class="linkifyplus" href="http://www.problogdesign.com/how-to/separating-trackbacks-from-comments/">http://www.problogdesign.com/how-to/separating-trackbacks-from-comments/</a></span></p>
<h3>5. Implement Pagination</h3>
<p>WordPress only includes links between the next and previous pages when displaying a list of posts such as on the home page. Download the <a href="http://www.lesterchan.net/wordpress/readme/wp-pagenavi.html">WP-PageNavi</a> plugin to add full pagination support.</p>
<div id="attachment_2529" class="wp-caption alignnone" style="width: 555px"><img class="size-full wp-image-2529" title="pagenavi" src="http://inspectelement.com/wp-content/uploads/2009/08/pagenavi.gif" alt="pagenavi" width="545" height="934" /><p class="wp-caption-text">The WP-PageNavi plugin is highly customisable.</p></div>
<h3>6. Hide the Excerpt if left Blank</h3>
<p>By default, if you have your theme set to display the excerpt and nothing is entered, WordPress will just display the full text instead. If you want don&#8217;t want anything displayed then simply place the following code wherever you want the excerpt to appear (or not)</p>
<pre>&lt;?php if(!empty($post-&gt;post_excerpt)) {the_excerpt(); } ?&gt;</pre>
<p>Source: <a href="http://twitter.com/boagworld/status/3510009097">Paul Boag on Twitter</a></p>
<h3>7. Easier to Read, Meaningful URLs</h3>
<p>Head into the permalink settings in the settings section of your WordPress admin area and change it from anything except <em>Default </em>and <em>Month and name. </em>The image below shows how Inspect Element has it setup showing the category first followed by the post title such as:</p>
<p><a href="http://inspectelement.com/tutorials/animate-a-contact-us-slide-out-area-using-jquery/">http://inspectelement.com/tutorials/animate-a-contact-us-slide-out-area-using-jquery/</a></p>
<div id="attachment_2540" class="wp-caption alignnone" style="width: 555px"><img class="size-full wp-image-2540" title="permalink" src="http://inspectelement.com/wp-content/uploads/2009/08/permalink.gif" alt="permalink" width="545" height="242" /><p class="wp-caption-text">Changing the permalink settings will ensure better URLs.</p></div>
<p>Not only will the make it easier to read for the user, it also makes it easier to understand for search engines to pick up resulting in better SEO. Make sure you change it!</p>
]]></content:encoded>
			<wfw:commentRss>http://inspectelement.com/tutorials/7-very-simple-tips-and-tricks-for-getting-more-out-of-wordpress/feed/</wfw:commentRss>
		<slash:comments>45</slash:comments>
		</item>
		<item>
		<title>A Look at Some of the New Selectors Introduced in CSS3</title>
		<link>http://inspectelement.com/tutorials/a-look-at-some-of-the-new-selectors-introduced-in-css3/</link>
		<comments>http://inspectelement.com/tutorials/a-look-at-some-of-the-new-selectors-introduced-in-css3/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 08:05:55 +0000</pubDate>
		<dc:creator>Tom Kenny</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://inspectelement.com/?p=1585</guid>
		<description><![CDATA[Everyone who has been using CSS is immediately familiar with selectors as they are what is used to target elements on a page and style them. CSS3 brings even more options as far as selecting elements goes. It will allow designers and developers to implement designs much easier and quicker than before. Here is a [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone who has been using CSS is immediately familiar with selectors as they are what is used to target elements on a page and style them. CSS3 brings even more options as far as selecting elements goes. It will allow designers and developers to implement designs much easier and quicker than before.</p>
<p><img title="css3-selectors" src="http://inspectelement.com/wp-content/uploads/2009/07/css3-selectors1.jpg" alt="css3-selectors" width="560" height="218" /></p>
<p>Here is a run-down of just some of the things that is possible with CSS3 selectors. Of course CSS3 isn&#8217;t supported at all by any IE browsers including IE8 but all latest versions of Safari, Firefox and Opera support most, if not all of them.</p>
<p><span id="more-1585"></span><strong><a href="http://inspectelement.com/demos/selectors/alternaterow/">Alternate Row Styling</a></strong></p>
<p><a class="rounded demo" href="http://inspectelement.com/demos/selectors/alternaterow/">view demo</a></p>
<p>There are no ways of targeting alternate elements using CSS2 but CSS3 has added comprehensive support allowing you to style odd or even rows or even every 3rd, 4th, 5th or user defined number of rows. There are ways of doing so using javascript or even server side code such as PHP but this CSS3 makes it so much easier and more flexible.</p>
<h4>Odd or Even Rows</h4>
<pre><code>li:nth-child(odd) { color: blue; margin-left: 15px; }
li:nth-child(even) { color: green; margin-left: 15px; }</code></pre>
<p>Very simple to select odd rows with CSS3 as you can see above example adding a margin and changing the colour of odd or even list-items.</p>
<h4>Every 3rd Row</h4>
<pre><code>li:nth-child(3n) { color: orange; margin-left: 15px; }</code></pre>
<h3><a href="http://inspectelement.com/demos/selectors/specificrow/">Specific Row Styling</a></h3>
<p><a class="rounded demo" href="http://inspectelement.com/demos/selectors/specificrow/">view demo</a></p>
<p>It&#8217;s just as easy to pick out a specific row, here targeting the 3rd list-item and 5th paragraph elements:</p>
<pre><code>li:nth-of-type(3) { color: blue; margin-left: 15px; }
p:nth-child(5) { color: green; margin-left: 15px; }</code></pre>
<h3><a href="http://inspectelement.com/demos/selectors/firstandlast/">First and Last Element Styling</a></h3>
<p><a class="rounded demo" href="http://inspectelement.com/demos/selectors/firstandlast/">view demo</a></p>
<p>Once again very easy to pick out the first and last defined elements using CSS3</p>
<h4>First Element</h4>
<pre><code>li:first-of-type { color: blue; margin-left: 15px; }</code></pre>
<h4>Last Element</h4>
<pre><code>p:last-of-type { color: green; margin-left: 15px; }</code></pre>
<h4>First Two Elements</h4>
<p>As a demonstration on how flexible CSS3 selectors can be here is an example of the first two elements being selected:</p>
<pre><code>li:nth-child(-n+2) { color: blue; margin-left: 15px; }</code></pre>
<h4>Last Two Elements</h4>
<p>Of course the same can be done with the last two elements:</p>
<pre><code>p:nth-last-child(-n+2) { color: red; margin-left: 15px; }</code></pre>
<p>Replacing the number 2 will target whatever desired number of elements at the beginning or end.</p>
<h4>All but First and Last Elements</h4>
<p>It is also possible to combine the above examples and reverse it so that you can target everything in between the first and last elements. This method is slightly different as it uses multiple, stacked selectors to get the job done:</p>
<pre><code>p:not(:first-of-type):not(:last-of-type) { color: orange; margin-left: 15px; }</code></pre>
<p>This means that it is also possible to select everything but the top two and bottom two elements by combining the :not selector and the :nth-child(-n+2) or :nth-last-child(-n+2) selectors:</p>
<pre><code>p:not(:nth-child(-n+2)):not(:nth-last-child(-n+2)) { color: blue; margin-left: 15px; }</code></pre>
<h3><a href="http://inspectelement.com/demos/selectors/enabledisable/">Styling Enabled and Disabled Input Fields</a></h3>
<p><a class="demo rounded" href="http://inspectelement.com/demos/selectors/enabledisable/">view demo</a></p>
<p>With CSS3 it is now even easier to style input fields based on whether they are disabled or not. This allows designers to improve usability by defining a more obvious way of communicating to the user that an input field is not available for use.</p>
<h4>Enabled</h4>
<pre><code>input:enabled {  border: 2px solid green; }</code></pre>
<h4>Disabled</h4>
<pre><code>input:disabled { background-color: #e7e7e7; border: 2px solid grey; }</code></pre>
<h3>The Future</h3>
<p>It&#8217;s clear to see that CSS3 selectors are going to make our lives easier as well as give us interesting new ways of looking at things in web design. Because CSS3 isn&#8217;t actually finalised and the lack of support from Microsoft, we haven&#8217;t really seen how CSS3 can change things but as more and more browsers support them and more and more users upgrade those browsers the more we&#8217;ll see CSS3 selectors in the wild. For now though, it is certainly feasible to start using them but not in a way that the design is so dependent on them that it will break in unsupported browsers.</p>
<h3>Further Reading:</h3>
<ul>
<li><a href="http://roshanbh.com.np/2008/03/different-color-alternate-row-jquery.html">Display different color in alternate row using jQuery</a></li>
<li><a href="http://www.somacon.com/p338.php">How to Alternate Table Row Colors in PHP and ASP</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://inspectelement.com/tutorials/a-look-at-some-of-the-new-selectors-introduced-in-css3/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Create a Button with Hover and Active States using CSS Sprites</title>
		<link>http://inspectelement.com/tutorials/create-a-button-with-hover-and-active-states-using-css-sprites/</link>
		<comments>http://inspectelement.com/tutorials/create-a-button-with-hover-and-active-states-using-css-sprites/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 08:00:58 +0000</pubDate>
		<dc:creator>Tom Kenny</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[css]]></category>

		<guid isPermaLink="false">http://inspectelement.com/?p=1156</guid>
		<description><![CDATA[Too many designers neglect the click state (active: property in CSS) in web design, either because they're unaware of it, underestimate the importance of it or are plain lazy. It's a simple affect that improves usability by giving the user some feedback as to what they've clicked on but can also add depth to a design.]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-1497" title="buttons" src="http://inspectelement.com/wp-content/uploads/2009/07/buttons.jpg" alt="buttons" width="560" height="218" /></p>
<p>Too many designers neglect the click state (active: property in CSS) in web design, either because they&#8217;re unaware of it, underestimate the importance of it or are plain lazy. It&#8217;s a simple effect that improves usability by giving the user some feedback as to what they&#8217;ve clicked on but can also add depth to a design.</p>
<p>First, a look at the working button.</p>
<p><span id="more-1156"></span><a class="button center" onclick="jquery" href="javascript:;">Button</a></p>
<p>This is the finished version of what will be built for this tutorial.</p>
<h3>The Design</h3>
<p>First thing we need to do is open up photoshop and create a design for the button. In this instance, we want to make it look very distinctive as a button:</p>
<p><img class="alignnone size-full wp-image-1460" title="button_static" src="http://inspectelement.com/wp-content/uploads/2009/07/button_static.png" alt="button_static" width="186" height="52" /></p>
<p>Here it&#8217;s nice and big for the demo just to make things nice and clear but buttons shouldn&#8217;t need to big as big as this for the majority of uses.</p>
<h4>Hover State Image</h4>
<p>We need to have a slightly different style for when a user hovers over the button just to give them an indication that the button is interactive and therefore clickable, a standard web practice.</p>
<p><img class="alignnone size-full wp-image-1461" title="button_hover" src="http://inspectelement.com/wp-content/uploads/2009/07/button_hover.png" alt="button_hover" width="186" height="52" /></p>
<p>The hover state is slightly darker than the normal static appearance but very noticeable difference when the user actually hovers over the element.</p>
<h4>Click State Image</h4>
<p>Now for the part that a lot of designers miss out on. We need a third state that changes when the user clicks on the button.</p>
<p><img class="alignnone size-full wp-image-1463" title="button_click" src="http://inspectelement.com/wp-content/uploads/2009/07/button_click.png" alt="button_click" width="186" height="52" /></p>
<p>We&#8217;ve gone with the visual metaphor of an actual, physical button like ones you see on a mobile phone or mp3 player. The user then has an immediate recognition that a button performs a function when pressed.</p>
<p>A simple inner shadow, reversing the gradient and moving the text down one pixel achieves this effect nicely.</p>
<h4>Sprite Image</h4>
<p><img class="alignnone" title="Button Sprite" src="http://inspectelement.com/wp-content/themes/inspectelementv2/style/images/button.png" alt="" width="186" height="156" /></p>
<p>The best practice is to combine all button states into one image and divide them out using CSS. This is because it:</p>
<ul>
<li>reduces http requests resulting in faster transfers</li>
<li>prevents flickering effect caused by change of state by loading all states as one file</li>
</ul>
<h3>The CSS Code</h3>
<p>Now that we&#8217;ve brought the different states into a single image we need to tell the browser what part of the image we want when necessary through CSS.</p>
<p>The static, initial state of the button is defined in CSS as follows:</p>
<pre><code>a.button {
	background: url(../images/button.png) no-repeat 0 0;
	width: 186px;
	height: 52px;
	display: block;
	text-indent: -9999px;
}</code></pre>
<p>The background image is positioned to the top and left with the width and height of the button being defined as to only show the top third of the sprite. The rest of the code is a simple image replacement technique on the &lt;a&gt; tag that has a class of &#8216;button&#8217;.</p>
<h4>Hover State CSS</h4>
<p>The hover state retains all properties and values with the exception of the background position as it&#8217;ll need to be pushed up to show the second part of the sprite as shown:</p>
<pre><code>a.button:hover { background-position: 0 -52px; }</code></pre>
<p>Changing the first value would result in the background image moving left and right along the X axis. Obviously we don&#8217;t want that so the image is moved upwards along the Y axis as a negative value of the height of the button itself. This moves the hover state of the sprite into view when the mouse hovers over the link.</p>
<h4>Click State CSS</h4>
<p>As you can probably guess the click state will basically be the same but moving the button up again as follows:</p>
<pre><code>a.button:active { background-position: 0 -104px; }</code></pre>
<h3>Where Else Sprites Should be Used</h3>
<p>If you&#8217;re navigation relies on images then all states can be combined into one big sprite image. Combining all buttons that appear one one page or a single section of your site into one image can be a great way to cut down on http requests. In fact I can show you the buttons I used on a recent project, all listed on a <a href="http://inspectelement.com/demos/buttons/">single page</a>.</p>
<p><a class="demo rounded" href="http://inspectelement.com/demos/buttons/">View the Buttons!</a></p>
<p>Just to show you what I mean about combining buttons onto a single sprite image take a look at <a href="http://inspectelement.com/demos/buttons/bpBtns.gif">this image</a>. Buttons can be added to the end of the row without affecting any of the others.</p>
]]></content:encoded>
			<wfw:commentRss>http://inspectelement.com/tutorials/create-a-button-with-hover-and-active-states-using-css-sprites/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>Animate a Contact Us Slide-Out Area using jQuery</title>
		<link>http://inspectelement.com/tutorials/animate-a-contact-us-slide-out-area-using-jquery/</link>
		<comments>http://inspectelement.com/tutorials/animate-a-contact-us-slide-out-area-using-jquery/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 08:00:19 +0000</pubDate>
		<dc:creator>Tom Kenny</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://inspectelement.com/?p=1137</guid>
		<description><![CDATA[Contact us pages are usually boring static pages with a form, not very exciting so what we&#8217;re going to do is place the contact us form at the top of the page and create a button that slides out and reveals the form when clicked. All with the help of our little friend, jQuery. View [...]]]></description>
			<content:encoded><![CDATA[<p>Contact us pages are usually boring static pages with a form, not very exciting so what we&#8217;re going to do is place the contact us form at the top of the page and create a button that slides out and reveals the form when clicked. All with the help of our little friend, jQuery.</p>
<p><img style="border: 0px initial initial;" title="contactjQuery" src="http://inspectelement.com/wp-content/uploads/2009/07/contactjQuery.gif" alt="contactjQuery" width="560" height="218" /></p>
<p><a class="demo rounded" href="http://inspectelement.com/demos/jquerycontactus/">View the Demo</a> <a class="download rounded" href="http://inspectelement.com/demos/jquerycontactus/jquerycontact.zip">Download Files (.zip)</a></p>
<p><span id="more-1137"></span>First we start of with the necessary file includes:</p>
<pre>&lt;link rel="stylesheet" href="contact.css"/&gt;</pre>
<pre><span>&lt;script src="<a class="linkifyplus" href="http://jqueryjs.googlecode.com/files/jquery-1.3.js">http://jqueryjs.googlecode.com/files/jquery-1.3.js</a>" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="jquery.easing.1.3.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script src="contact.js" type="text/javascript"&gt;&lt;/script&gt;</span></pre>
<p>We&#8217;re using jQuery 1.3 hosted by Google, the <a href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery easing plugin</a> and our own custom code in the contact.js file. Make sure that the jQuery library comes first, followed by the plugin(s) and finally your code that makes the magic happen.</p>
<p>Let&#8217;s set the height of the contactArea div to the desired height in the css. We&#8217;re going to hide it with jQuery so that anyone with javascript turned off will still see the form and be able to use it.</p>
<pre>#contactArea { height: 225px; }</pre>
<p>Of course we need to start off with the $(document).ready() function so that jQuery knows what code to load and use.</p>
<pre>$(document).ready(function() {

        // put all your jQuery goodness in here.

});</pre>
<p>The first line of code is going to be the code mentioned earlier to hide the contactArea div. Here we are basically telling jQuery to set the height of #contactArea to 0.</p>
<pre>$(document).ready(function(){ 

	$("#contactArea").css('height', '0px');</pre>
<pre>});</pre>
<p>Right, time to tell jQuery to do something when the button is clicked. Obviously we want the contact us area to slide out from the top of the page to reveal the form. We will also want to hide the area when the button is clicked again. This is achieved by using jQuery&#8217;s built-in toggle function.</p>
<pre>$(document).ready(function(){ 

	$("#contactArea").css('height', '0px');

	$("a.contact").toggle(
		function () {
 			$("#contactArea").animate({height: "225px"}, {queue:false, duration: 1700, easing: 'easeOutBounce'})
                },
                function () {
			$("#contactArea").animate({height: "0px"}, {queue:false, duration: 1700, easing: 'easeOutBounce'})
		}
	); 

});</pre>
<p>Basically what is happening here is that the toggle function is toggling between two different functions. One displays the full height of #contactArea and the other sets the height to 0, hiding it. By the simple use of .animate and setting the duration (milliseconds), jQuery animates between the two height values. The easeOutBounce value ties in with theÂ <a href="http://gsgd.co.uk/sandbox/jquery/easing/">jQuery easing plugin</a> that adds a bit of a fun element that keeps things interesting. I&#8217;ll let you <a href="http://inspectelement.com/demos/jquerycontact/">view the demo</a> to see what it does.</p>
<p><strong>UPDATE: </strong>See <a href="http://inspectelement.com/tutorials/animate-a-contact-us-slide-out-area-using-jquery/comment-page-1/#comment-168">Joel&#8217;s comment</a> below on how to prevent a jolt effect that happens if the height of the page becomes taller than the browser window, causing the scroll bar to appear during the animation and vice versa.</p>
]]></content:encoded>
			<wfw:commentRss>http://inspectelement.com/tutorials/animate-a-contact-us-slide-out-area-using-jquery/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.450 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-09-10 10:38:25 -->
