<?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>Kyle Schaeffer - Web Design and SharePoint Branding &#187; Images</title>
	<atom:link href="http://kyleschaeffer.com/tag/images/feed/" rel="self" type="application/rss+xml" />
	<link>http://kyleschaeffer.com</link>
	<description>Web Design &#38; SharePoint Branding</description>
	<lastBuildDate>Wed, 01 Feb 2012 23:01:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>10 Things a Website Should Never, Ever Do</title>
		<link>http://kyleschaeffer.com/best-practices/10-things-a-website-should-never-ever-do/</link>
		<comments>http://kyleschaeffer.com/best-practices/10-things-a-website-should-never-ever-do/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 21:19:15 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[Images]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Web Browsers]]></category>

		<guid isPermaLink="false">http://kyleschaeffer.com/?p=994</guid>
		<description><![CDATA[As a designer of the world wide web, you are armed with the power to amaze, enlighten, entice, and captivate. The web is an easel for your creative aspirations, and the content you design for is the foundation of your &#8230; <a href="http://kyleschaeffer.com/best-practices/10-things-a-website-should-never-ever-do/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As a designer of the world wide web, you are armed with the power to amaze, enlighten, entice, and captivate. The web is an easel for your creative aspirations, and the content you design for is the foundation of your creativity. With so much power at the tips of your fingers, you also possess the ability to deter, annoy, anger, and infuriate. Your users are yours to command, their emotions yours to pluck like the strings of a harp.<span id="more-994"></span></p>
<p>It&#8217;s the latter of these powers that we discuss today: your ability to destroy the desire for users to stay on your site. We&#8217;ll examine the causes of user strife on the web, and see clear examples of common mistakes that designers and developers all-too-often seem to make.</p>
<h2>1. Never interfere with the ability to scroll</h2>
<p>The browser window is a fairly simple application: an address/search bar, a few buttons, and a big window where users read, scroll, and click. Sure, most browsers have other bells and whistles, but it really boils down to these essential elements of the browsing experience. Rule number one: never, ever (ever, ever) interfere with these most basic features of the browser window.</p>
<h3>Example: Microsoft SharePoint 2010</h3>
<p><img class="alignright" title="Microsoft SharePoint 2010" src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2011/09/sharepoint-2010.jpg" alt="Microsoft SharePoint 2010" width="300" height="175" />One of the most preposterous features of an interface that I&#8217;ve seen is SharePoint 2010&#8242;s new ribbon interface. The default SharePoint 2010 interface includes a simple CSS style that disables the scrollbar on the <code>&lt;body&gt;</code> element. Microsoft chooses to remedy this by adding a scrollbar to other division elements in the interface instead. This results in a fairly impressive &#8220;fixed&#8221; ribbon, but it has some infuriating side-effects.</p>
<ul>
<li>When a SharePoint 2010 page loads, users will not be able to scroll until all JavaScript has loaded.  On slow servers or on large pages, this can take up to 2-3 seconds, which can be quite infuriating.</li>
<li>Some devices don&#8217;t execute the JavaScript in the expected fashion, resulting in the complete inability to scroll on mobile devices and tablets.</li>
</ul>
<h3>An easy solution</h3>
<p>The truth is, creating a &#8220;fixed&#8221; element is a fairly simple CSS technique that has become extremely popular in the last few months. The complexity of Microsoft&#8217;s interface is it&#8217;s downfall. Always practice in simplicity, because fewer things can go wrong in the end. Build simple interfaces, and <em>never</em> disable the scroll bar. Do this, and you&#8217;ll know at least one person who doesn&#8217;t hate your guts.</p>
<h2>2. Never allow form resubmissions</h2>
<p>Forms are a fairly standard feature of the web. Users see them and use them all the time: to sign up, sign in, order, update, and the like. With so much familiarity, it&#8217;s a wonder that forms are one of the largest sources of frustration to users. Between data, validation, formatting, handling errors, and all the auxiliary things that seem to surround web forms, things can get pretty complex for designers and developers. All the while, you try to keep it simple for your users. It&#8217;s a tall order, to be sure, but there is at least one thing that you can do to help users stay calm.</p>
<h3>Example: The Form Resubmission Prompt</h3>
<p><img class="alignnone size-medium wp-image-1008" title="Form Resubmission" src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2011/09/form-resubmission.jpg" alt="Form Resubmission" /></p>
<p>This is Google Chrome&#8217;s form resubmission prompt. Most browsers have something very similar. This appears when users click on the &#8220;Back&#8221; and &#8220;Forward&#8221; buttons in the browser, or when they &#8220;Refresh&#8221; a page on which they have submitted a form. As web junkies, we might know what this means, but it has a more elusive meaning to your every-day internet users. Most of the time, you&#8217;ll find that users simply click the default option (in this case, &#8220;Continue&#8221;), which can lead to duplication of orders, data, requests, and all sorts of things that would be better off if avoided. Also, it&#8217;s just another annoying prompt that users encounter while they&#8217;re using your site.</p>
<h3>A Simple Solution</h3>
<p>The solution to form resubmissions really depends on the platform your website runs on. In most cases, a simple fix is to separate the script that submits the form data, and the script that receives and processes that data. For example, if you&#8217;re using a PHP-based platform, you might have a form that looks like this:</p>
<pre>&lt;form action="submit.php"&gt;
  &lt;input type="text" name="user" required /&gt;
  &lt;input type="password" name="pass" required /&gt;
  &lt;input type="submit" value="Log in" /&gt;
&lt;/form&gt;</pre>
<p>To avoid the resubmission prompt, your <code>submit.php</code> script would <strong>forward</strong> to another page, rather than displaying a page in the browser.</p>
<pre>if(isset($_POST['user']) &amp;&amp; isset($_POST['pass'])){
  // do something with the form data
  <strong>header('Location:/login/form.php?success=true');</strong>
}</pre>
<p>This receiving script never actually displays anything in the browser window. Instead, it receives the form data, does something with it, and then forwards the user somewhere else. Using this technique, when users click on the &#8220;Back&#8221; or &#8220;Forward&#8221; button, the browser will skip the <code>submit.php</code> page completely, and never see the annoying form resubmission prompt.</p>
<h2>3. Never disable keyboard support</h2>
<p><img class="alignright size-full wp-image-1009" title="Sprint Sign-In" src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2011/09/sprint-sign-in.jpg" alt="Sprint Sign-In" width="179" height="357" />While we&#8217;re on the topic of forms, let&#8217;s look at another deviation from web standards you&#8217;ll want to avoid. To the right, you&#8217;ll see a screenshot of the login form at <a href="http://mysprint.sprint.com">mysprint.sprint.com</a>. I have a Sprint mobile phone, and I occasionally use this login form to sign in and review my account, see my bill, or (more commonly) daydream about all the fancy new mobile phones that I don&#8217;t have.</p>
<h3>What went wrong</h3>
<p>The font sizes are a little small for my taste, but the appearance of this form is not the worst I&#8217;ve seen (yes, that was a compliment). Design and aesthetics aside, there&#8217;s one feature of this form that drives me absolutely crazy. It&#8217;s an extremely simple form, one that I&#8217;ve encountered on countless other websites before. As usual, I would expect to enter my username and password to sign in without a fuss.</p>
<p>Unfortunately, this is not the case. While focusing in either the username or password textbox, pressing the ENTER key does absolutely nothing. I&#8217;m not the type of user that wastes time after filling out a form by lifting my hand from the keyboard and finding the submit button with my mouse cursor. I&#8217;m all about speed: on most websites, it&#8217;s type, type, ENTER, and the form has been submitted. On Sprint&#8217;s website, however, they&#8217;ve removed this behavior, and thus they&#8217;ve earned a place on my list of don&#8217;t-do&#8217;s.</p>
<h2>4. Never fail to give feedback</h2>
<p><img class="alignright size-full wp-image-1016" title="Facebook - Add Favorite" src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2011/09/facebook-add-favorites.jpg" alt="Facebook - Add Favorite" width="201" height="344" />Feedback is important, especially if you&#8217;re working with the awesomeness of AJAX. Traditionally, you knew what was going on in a web page, because any time you clicked on something, you had to wait while the next page loaded. There was a very apparent interaction period, and very obvious feedback from that interaction. With the introduction of new technology like AJAX, however, that feedback is not always so obvious. Today&#8217;s websites are much more interactive, and the result of those interactions (whether successful or not) needs to be communicated to the user.</p>
<h3>Example: Facebook</h3>
<p>There&#8217;s an easy way to test this: visit a web page, turn off your wireless adapter, and then click on things and see what happens. Obviously, because you&#8217;re not online, anything you do should be very obviously followed by a &#8220;no connection&#8221; message or some sort of indication that you&#8217;ve failed to do something. Facebook, a website that makes gratuitous use of AJAX for interaction, is not so good about warning users when things have failed.</p>
<p><strong>Editor&#8217;s note:</strong> yes, I am using pirate Facebook.</p>
<p>One particular example is the new &#8220;lists&#8221; feature that allows you to mark a list as &#8220;favorite.&#8221; Even when you&#8217;re offline, Facebook gives you no indication that the action has failed. Never assume that users will have a fast connection, or that AJAX requests will complete. You should always provide feedback if something fails, especially when no page loads are involved.</p>
<h2>5. Never disable keyboard navigation</h2>
<p>Different strokes for different folks. That&#8217;s a saying that I like to spew off at random times, usually in a failed attempt at humor, but the lesson of this silly quip is tried and true: everyone has their own way of doing things. This can also be applied to navigation on the internet. Some people prefer to use their cursor for absolutely everything, and only resort to keyboard use when absolutely necessary. Others use the keyboard almost entirely, tabbing, backspacing, and scrolling their way through the world of the world wide web. Others, still, use gestures and touch screens to flick and fly their way through the internet. As a crafter of the interactive, you must adhere to all of these people. Never detract from your users&#8217; ability to navigate in whatever way they damn well please.</p>
<h3>Example: No, I don&#8217;t want to search</h3>
<p><img class="alignright size-full wp-image-1027" title="eBay Auto-focus" src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2011/09/ebay-search.jpg" alt="eBay Auto-focus" width="202" height="101" />I&#8217;m going to use eBay as an example, just because they&#8217;re so big, but many websites <em>out there</em> are guilty of this annoyance. Upon arriving at eBay&#8217;s website, they use JavaScript to auto-focus on the search bar. I guess they&#8217;ve already decided, before you even visit, that you want to search their website. For some users, however, this can be incredibly annoying. A common and simple way to scroll down the page, in all browsers, is to press the space key. Pressing this key will advance the screen about one page, so you can continue reading without having to worry about scroll bars and the like. If you&#8217;re auto-focused on a search box, however, it disables your ability to do this. Even if it&#8217;s only a minor annoyance, it can be incredibly frustrating to users who like to navigate in this fashion. Likewise, I often use the backspace key instead of the back button to go back when I didn&#8217;t find what I was looking for. With the focus on a search field, backspace navigation simply doesn&#8217;t work.</p>
<p>The fix for this one is easy: don&#8217;t do it. It&#8217;s annoying.</p>
<h2>6. Never move content without user interaction</h2>
<p>Websites can be so damn sneaky. I guess they need to make a buck, but who doesn&#8217;t? One thing that will drive your users bonkers is anything that moves without a prompt from the user. Yes, I&#8217;m talking about you, &#8220;auto-expanding-advertisement-that-plays-a-stupid-video-of-a-guy-who-walks-across-my-screen-when-I-just-want-to-read-the-damn-article&#8221; guy. I also dislike anything that happens on hover (including drop-down menus). Hover is so 2000&#8242;s, get with the times, people. The only time your website should &#8220;move&#8221; or &#8220;do something&#8221; is when users tell it to. Most simply, any time they click, drag, or scroll. That sounds simple and obvious, but not everyone adheres to this most basic of principles.</p>
<h3>Example: Digg.com</h3>
<p><img class="alignnone size-full wp-image-1028" title="Digg Advertisement" src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2011/09/digg-advertisement.jpg" alt="Digg Advertisement" width="600" height="300" /></p>
<p>While the quality of Digg&#8217;s content is another concern, one thing that does drive me crazy is the sponsored links that appear in the rollup. Notice the promotion from NewEgg.com. This link does not actually appear on page load, but rather when users hover their mouse cursor into the rollup of popular stories. This means that if you&#8217;re a fast clicker (aren&#8217;t we all?), you will often accidentally click on the advertisement instead of the story you&#8217;re interested in. Good for Digg, bad for users. Stop being so shifty, internet.</p>
<h2>7. Never use fixed position without a fallback</h2>
<p>A &#8220;fixed&#8221; element in the browser window is one that stays on the screen, even as you scroll down the page. It&#8217;s a simple CSS technique, but it&#8217;s been amazingly popular in recent months. One thing I&#8217;ve noticed in all these fixed designs is the failure to provide a fallback for users who are on smaller screens. The truth of the matter is that the web isn&#8217;t just for desktops any more. Internet connectivity is coming in all sorts of shapes and sizes: desktops, laptops, mobiles, tablets, e-readers, gaming consoles, and even refrigerators (yes, even refrigerators). The future promises only more diversity in internet-connected devices, and that means you can&#8217;t assume users will have a large viewing area on which to see your website.</p>
<h3>Example: Pandora.com</h3>
<p><img class="alignright size-full wp-image-1035" title="Pandora Fixed" src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2011/09/pandora-fixed-nav.jpg" alt="Pandora Fixed" width="403" height="269" />This is a screenshot of Pandora&#8217;s fancy new HTML5/CSS3 design. First of all, I&#8217;ll say that I love Pandora.  Maybe too much. It&#8217;s pretty awesome, and it even lets me give all of my radio stations quirky little names like &#8220;Harmonizatorasaurous&#8221; (eat that, spell-check).</p>
<p>Pandora&#8217;s new design includes a fixed header, like many new designs, but it seems the header does not provide a fallback for users on a smaller screen. When reducing the window width, it clips the player controls off the edge of the screen. If a fixed element is clipped, users can&#8217;t see it, even if they try to scroll to see more, which can be a huge problem.</p>
<h3>A simple solution</h3>
<p>An easy solution to this problem is to make the default behavior of your site&#8217;s header to maintain a static position, but when users have a large enough screen, you can make things fixed for a more impressive presentation.  The following jQuery snippet does the trick quite nicely:</p>
<pre>$(window).resize(function(){
  resizeUI();
}); 
$(document).ready(function(){
  resizeUI();
});

<strong>// resize on page load AND window resize</strong>
<strong>function resizeUI(){</strong>
<strong> if($(window).width() &gt; 500){</strong>
<strong> $('#header').css('position', 'fixed');</strong>
<strong> }</strong>
<strong> else{</strong>
<strong> $('#header').css('position', 'static');</strong>
<strong> }</strong>
<strong>} </strong></pre>
<p>This script runs both on page load AND as users resize the window, so no matter what happens, you can decide whether or not to use fixed elements. You&#8217;ll have to mess with the values that the script looks at (width and height) to determine what works best for your site&#8217;s design, but it&#8217;s a useful technique to use.</p>
<h2>8. Never use pop-up windows</h2>
<p>Do I really even have to mention this one? I thought that pop-ups were notorious for the infuriating behavior that have on users, but I still see them &#8220;pop up&#8221; from time to time (pun <em>intended</em>).</p>
<h3>Example: TinyMCE</h3>
<p><img class="alignright size-full wp-image-1036" title="TinyMCE" src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2011/09/tinymce.jpg" alt="TinyMCE" width="185" height="98" />I never use pop-ups. I always recommend against them. A common excuse is that <em>your</em> site should stay open, in it&#8217;s own tab, even if users click a link that takes them away from your site. I&#8217;ve got a simple response to that: wrong! Don&#8217;t let your head grow so big that you think your website is god&#8217;s gift to the internet. Users have gotten pretty comfortable with the idea of tabbed browsing, and they know how to manage their windows. Unless you&#8217;re Google, you&#8217;re not allowed to use pop-ups. It&#8217;s that simple.</p>
<p>Imagine my surprise when I attempted to implement the TinyMCE JavaScript editor into a web application I was building, and realized it still used pop-up windows for things like links and images. I am building a PHP application, and I have had stars in my eyes for WordPress the entire time, so TinyMCE was the obvious choice. I was so taken aback by this behavior that I ended up switching to CKEditor, another popular editor that has recognized the need to rid the world of these annoying little boxes, and I&#8217;m all the happier for it.</p>
<h2>9. Never get quirky (well, not <em>too</em> quirky)</h2>
<p>I love websites that are different, but not <em>too</em> different. There&#8217;s a fine balance to be made between adhering to expectations, and getting so weird that users have no idea what&#8217;s going on. As with most users, if I visit a website and am prompted to &#8220;explore this insanely huge image of nonsense to learn how to navigate our site,&#8221; I&#8217;m going to leave and never return. I&#8217;ve never been a proponent of Flash, for this very reason, but I also recognize that it has it&#8217;s place. Flash can enhance a website&#8217;s content with some awesome features, but it should never be used to present content in its entirety.</p>
<h3>Example: Sony.com</h3>
<p><img class="alignright size-full wp-image-1038" title="Sony" src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2011/09/sony.jpg" alt="Sony" width="305" height="133" />Check out <a href="http://www.sony.com">Sony.com</a>, and you&#8217;ll realize that a full 5-8 seconds will go by before you actually see anything on the screen that you can click on. Almost the entire site is in Flash, and it breaks about five of the ten &#8220;don&#8217;t do&#8217;s&#8221; that I&#8217;ve described in this article. All that aside, Sony has provided a non-Flash version of their site, which also subsequently presents a loading spinner for about 2-3 seconds that covers all of the content on the page. I&#8217;m not entirely sure why the designer who created the Sony website was so fond of things that come between users and consuming the content they came to read, but I do know this: it&#8217;s annoying. Don&#8217;t do it.</p>
<h2>10. Never do THIS&#8230;</h2>
<p>Okay, this last one is really just for fun, but never do THIS&#8230;</p>
<pre>body * {
  -webkit-transition: all 0.5s ease;
  -moz-transition: all 0.5s ease;
  -o-transition: all 0.5s ease;
  transition: all 0.5s ease;
}
body *:hover {
  -webkit-transform: rotate(180deg);
  -moz-transform: rotate(180deg);
  -o-transform: rotate(180deg);
  transform: rotate(180deg);
}</pre>
<p>Try it out by clicking on this button (you&#8217;ve been warned):</p>
<input id="crazy-button" type="button" value="Let's get crazy" />
<script src="/wordpress/wp-content/themes/shakefive/js/crazy.js"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/best-practices/10-things-a-website-should-never-ever-do/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Image Buttons and Accessibility</title>
		<link>http://kyleschaeffer.com/best-practices/image-buttons-and-accessibility/</link>
		<comments>http://kyleschaeffer.com/best-practices/image-buttons-and-accessibility/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 21:29:32 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Images]]></category>
		<category><![CDATA[Text]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.kyleschaeffer.com/?p=358</guid>
		<description><![CDATA[Image buttons are a fairly common occurrence in web media. As with everything else in web design, you have a dizzying arsenal of methods from which you can choose to create this type of design element, and choosing the right &#8230; <a href="http://kyleschaeffer.com/best-practices/image-buttons-and-accessibility/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Image buttons are a fairly common occurrence in web media. As with everything else in web design, you have a dizzying arsenal of methods from which you can choose to create this type of design element, and choosing the right method can greatly aid in your design&#8217;s accessibility, performance, and SEO-friendliness.<span id="more-358"></span></p>
<h2>Concerning Accessibility</h2>
<p>Accessibility is chiefly important for a web designer (or at least, it should be). When you create your HTML, keep things as simple as possible. Assume that every single user who visits your site will (1) not have CSS support, (2) will disable all images on your page, and (3) will not have JavaScript enabled. If you design your HTML in this fashion, you&#8217;ll find that creating accessible content is much easier to do. Once you have an accessible document that works on all systems, you can use the fantastic features of CSS and client-side scripting to really bring your site to life. These &#8220;nice to have&#8221; features (style, scripting, etc.) are not essential to the structure of your document or the content that&#8217;s contained within. When it comes down to it, users are after your content, so that&#8217;s priority number one.</p>
<h2>A Simple Example</h2>
<p>With that in mind, let&#8217;s say we wanted to create an image that links to another page (this is so very simple, but it serves as a great example of this technique). Because we&#8217;re assuming that users have disabled all images, we certainly don&#8217;t want to use the <code>&lt;img/&gt;</code> tag for our link, because those users without image support simply won&#8217;t see it. For that reason, our link will look like any other link on the site.</p>
<pre>&lt;a class="learnGuitar" href="http://www.mahalo.com/how-to-play-guitar-for-newbies"&gt;Learn Guitar&lt;/a&gt;</pre>
<p>I know&#8230;this is really simple, but stay with me; I promise we&#8217;re going somewhere with this. Our very simple HTML has passed our criteria:  users with CSS disabled will see the link, as will users without images or script. It&#8217;s very simply an accessible link on our page, read as easily by normal users as it is by search engines or even people using screen readers. Next, for users who can utilize our &#8220;nice to have&#8221; features, we&#8217;ll add a bit of CSS to make our image appear.</p>
<pre>.learnGuitar {
	display: block;
	width: 200px;
	height: 50px;
	background: url('/path/to/learn-guitar.png');
	text-indent: -9999em;
}</pre>
<p>As you can see, we&#8217;re using the <code>text-indent</code> CSS property to bump our text out of the way, and in it&#8217;s place, we&#8217;re using <code>background</code> to set an image for our link. All you have to do for your own image is adjust the width, height, and background URL to match. What you get when you&#8217;re all done is this:</p>
<style type="text/css">.learnGuitar{display: block;width: 200px;height: 50px;background: url('http://kyleschaeffer.com/wordpress/wp-content/uploads/2009/11/learn-guitar.png');text-indent: -9999em;}.learnGuitar:hover{border-style: none;background-color: transparent;}</style>
<p><a class="learnGuitar" href="http://www.mahalo.com/how-to-play-guitar-for-newbies">Learn Guitar</a></p>
<h2>Adding a Hover Image</h2>
<p>Easy and accessible CSS image replacement! It looks great, but let&#8217;s take it one more level to really make sure users know that our button DESERVES to be clicked. Let&#8217;s add a hover style. I&#8217;m going to use an image &#8220;sprite&#8221; for the hover image, which means that both our static and hover states are contained within the same image. Here&#8217;s my *single* image that&#8217;s used for this type of style:</p>
<p><img src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2009/11/learn-guitar-hover.png" alt="Learn Guitar Image Sprite" title="Image sprite - note that both button states are contained within the same image!" width="200" height="100" /></p>
<p>We&#8217;ll adjust our CSS to account for our new hover image. Note that the <code>height</code> and <code>width</code> attributes will not change! The hover-state image will be &#8220;clipped,&#8221; so that it&#8217;s only visible when users move their mouse cursor over our image button.</p>
<pre>.learnGuitar {
	display: block;
	width: 200px;
	height: 50px;
	background: url('/path/to/learn-guitar.png') top;
	text-indent: -9999em;
}
.learnGuitar:hover {
	background-position: 0 -50px;
}</pre>
<p>Now, when users move their mouse cursor over our image button, the CSS will &#8220;slide&#8221; the background image so that the hover state is displayed instead of the static state.</p>
<style type="text/css">.learnGuitarHover{display: block;width: 200px;height: 50px;background: url('http://kyleschaeffer.com/wordpress/wp-content/uploads/2009/11/learn-guitar-hover.png') top;text-indent: -9999em;}.learnGuitarHover:hover{background-position: 0 -50px;border-style: none;background-color:transparent;}</style>
<p><a class="learnGuitarHover" href="http://www.mahalo.com/how-to-play-guitar-for-newbies">Learn Guitar</a></p>
<p>Crafting your image buttons in this fashion can really save on performance and download times. Perhaps more importantly, your site will be much more &#8220;friendly&#8221; to visually impaired users using screen readers, and you&#8217;ll find that search engines will have an easier time understanding what your links and other content are all about.</p>
<p>Let me know if you have any questions or comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/best-practices/image-buttons-and-accessibility/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Pure CSS Image Hover</title>
		<link>http://kyleschaeffer.com/best-practices/pure-css-image-hover/</link>
		<comments>http://kyleschaeffer.com/best-practices/pure-css-image-hover/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 14:14:17 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DHTML]]></category>
		<category><![CDATA[Images]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.kyleschaeffer.com/?p=142</guid>
		<description><![CDATA[Many site designs will feature varying types of image &#8220;hover&#8221; states, where an image or background image changes when you move your mouse cursor into that area of the page. Traditionally, this change in image is handled via JavaScript. It&#8217;s &#8230; <a href="http://kyleschaeffer.com/best-practices/pure-css-image-hover/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Many site designs will feature varying types of image &#8220;hover&#8221; states, where an image or background image changes when you move your mouse cursor into that area of the page. Traditionally, this change in image is handled via JavaScript. It&#8217;s fairly easy to write a small script that swaps out images on mouseover, but there are a number of disadvantages to this approach that have pushed many web developers toward using a CSS-only method of achieving this exact same effect. This tutorial describes exactly how to implement a pure CSS image hover effect.<span id="more-142"></span></p>
<h2>The Image</h2>
<p>The biggest difference between a traditional JavaScript image hover and a pure CSS image hover is the image, itself. When using CSS to achieve this effect, the static image and the hover image are actually contained within the same image file. Basically, we&#8217;re displaying the image and cropping it so that only one image state is displayed at one time. In order to do this, we&#8217;ll omit the <code>&lt;img&gt;</code> tag and display the image as a the background-image of an <code>&lt;a/&gt;</code> (anchor) tag instead.</p>
<p>Let&#8217;s look at an image that could be used as a CSS hover image.</p>
<p style="text-align: center;"><img title="Both image states are contained within the same image." src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2009/01/buttonleafhover.png" alt="Hover image" width="100" height="200" /></p>
<h2>Simplistic Markup</h2>
<p>As you can see, both static and hover images are contained within the same file.  In order to display only half of the image at one time, we&#8217;ll apply it as a background color to an HTML block element.  Here is the HTML for this example:</p>
<pre>&lt;a class=&quot;myButtonLink&quot; href=&quot;#LinkURL&quot;&gt;Leaf&lt;/a&gt;</pre>
<h2>The CSS</h2>
<p>As you can see, the HTML is extremely simple.  We&#8217;re doing everything in CSS, so this is where the real magic happens:</p>
<pre>.myButtonLink {
	display: block;
	width: 100px;
	height: 100px;
	background: url('/path/to/myImage.png') bottom;
	text-indent: -99999px;
}
.myButtonLink:hover {
	background-position: 0 0;
}</pre>
<p>We&#8217;re using the CSS psuedo-element <code>hover</code> to apply the mouseover image effect.  When your mouse pointer moves over the &#8220;myButtonLink&#8221; element, our CSS slides the background image (using the <code>background-position</code> property) appropriately, giving us our mouseover image.  This is simple, fast, and efficient!  You&#8217;ll use less files and space on your server, clients will have to download less data, and older computers will render your content much faster.</p>
<h2>The Result</h2>
<p>Move your mouse over the image to see the hover in action.</p>
<style type="text/css">.myButtonLink { display: block; width: 100px; height: 100px; margin: 1em auto; background: url('http://kyleschaeffer.com/wordpress/wp-content/uploads/2009/01/buttonleafhover.png') bottom; text-indent: -99999px; }
.myButtonLink:hover { background-position: 0 0; background-color: transparent; border-style: none; }</style>
<p><a class="myButtonLink" href="javascript:alert('Accessible design is good design.\n~Steve Ballmer');">Leaf</a></p>
<p>And there you have it, a pure CSS approach to image hovers. You can apply this method to links, <code>&lt;div/&gt;</code> tags, and just about anything else you can imagine in your site&#8217;s design. Happy styling!</p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/best-practices/pure-css-image-hover/feed/</wfw:commentRss>
		<slash:comments>176</slash:comments>
		</item>
		<item>
		<title>Best Practices:  Images on the Web</title>
		<link>http://kyleschaeffer.com/best-practices/best-practices-images-on-the-web/</link>
		<comments>http://kyleschaeffer.com/best-practices/best-practices-images-on-the-web/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 16:09:48 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Images]]></category>

		<guid isPermaLink="false">http://www.kyleschaeffer.com/?p=121</guid>
		<description><![CDATA[Web design is about much more than HTML and CSS. In many cases, the quality of a website lies just as much in its code and functionality as it does in the quality and optimization of its images and other &#8230; <a href="http://kyleschaeffer.com/best-practices/best-practices-images-on-the-web/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Web design is about much more than HTML and CSS. In many cases, the quality of a website lies just as much in its code and functionality as it does in the quality and optimization of its images and other graphical information. The amount of choices in image format, quality, and optimization is dazzling to say the least. What format should you use? Is there a end-all format for the web that trumps all other formats?<span id="more-121"></span></p>
<h2>Connections, Not Size</h2>
<p>As internet connections increase in bandwidth and online content becomes increasingly available, image size is becoming less important. It&#8217;s still very important to optimize your images in order to minimize the download times for your pages, as it always will be, but there is no denying that image size is becoming less of a factor. One important element of internet connectivity to understand is the battle between image size and total number of images. On many high-speed internet connections, it&#8217;s actually faster to download one large image than it is to download many smaller images. The time it takes to make a server request factors in to every file the client must download when viewing a web page, so <em>combining multiple smaller images into one larger file</em> can greatly increase site performance. Dave Shea has written a great blog post about this technique, known as HTML Sprites, which <a href="http://www.alistapart.com/articles/sprites/">can be found here</a>.</p>
<h2>Diversity</h2>
<p>So, which image format is best? The answer lies in diversity. Each web-friendly image format has its own unique set of advantages and disadvantages that make it suitable in certain situations. While it would be nice to create all your images in the same format, pragmatism requires that you deviate from this formula in certain situations.</p>
<h2>The Amazing PNG</h2>
<p>In almost every case, 24-bit PNG images are superior to all other formats. The unique and most important benefit of PNG images is alpha transparency. In a nutshell, this allows you to create semi-transparent images that will display on top of any background color or image in a web page. The images I use in the header section of my site&#8217;s theme, for instance, are transparent PNG images. If you click on the clock at the top of this page, you&#8217;ll notice the background color of the page changes, but the images do not.</p>
<h3>Advantages</h3>
<ul>
<li><strong>Alpha Transparency</strong>: Semi-transparent images that do not have to be updated, even when your site design changes.</li>
<li><strong>File Size</strong>: Small images with few colors are stored in extremely small file sizes.</li>
<li><strong>Quality</strong>: Images are indexed with 24-bit color, saving only the color information that you need for that particular image.</li>
</ul>
<h3>Disadvantages</h3>
<ul>
<li><strong>Compatability</strong>: Older internet browsers (such as Internet Explorer 6) do not support alpha transparency. This problem can be fixed with <a href="http://homepage.ntlworld.com/bobosola/">a simple javascript function</a>, but CSS background images require a bit of a more complex solution in order to remedy.</li>
<li><strong>File Size</strong>: Large images with many colors (i.e. photos) can be very large in size.</li>
</ul>
<h2>JPEG for Photos</h2>
<p>JPEG images are the defacto standard for photos in many applications, including the world wide web. JPEG files are unsurpassed when it comes to files that contain many colors (sometimes millions of colors) and files that are very large in canvas size.</p>
<h3>Advantages</h3>
<ul>
<li><strong>File Size</strong>: When working with large files that contain many colors, the JPEG is the only choice.</li>
<li><strong>Quality Optimization</strong>: JPEG files can be optimized in quality to even further reduce file size.</li>
</ul>
<h3>Disadvantages</h3>
<ul>
<li><strong>No Transparency</strong>: JPEG images do not support transparency.</li>
<li><strong>File Overhead</strong>: Every image file has a certain amount of &#8220;overhead,&#8221; meaning that even when you save a 1&#215;1 pixel image, certain file attributes are still saved to that file. JPEG images have the largest overhead, somewhere around 300 bytes, which means that they aren&#8217;t well-suited for smaller images that do not have many colors.</li>
</ul>
<h2>The Tiny GIF</h2>
<p>GIF files are probably used more than any other format on the web (most likely due to their file size). The file overhead on a GIF file is under 50 bytes, meaning it&#8217;s well suited for small images that do not utilize a lot of colors.</p>
<h3>Advantages</h3>
<ul>
<li><strong>File Size</strong>: GIF files are great for images with a small canvas and very few colors because of an extremely small file size and similarly small download time.</li>
<li><strong>Transparency</strong>: GIF files support transparency, allowing you to layer images on other page elements. The transparency is not alpha-based, meaning you can&#8217;t have semi-transparent pixels, so transparent elements must have hard edges in order to display correctly on top of other elements.</li>
<li><strong>Animation</strong>: GIF files support animation, although file size quickly becomes a factor when using many different frames.</li>
</ul>
<h3>Disadvantages</h3>
<ul>
<li><strong>Limited Colors</strong>: A standard GIF file cannot contain more than 256 colors, meaning they aren&#8217;t well suited for photos or smooth gradients, which contain more color data.</li>
</ul>
<h2>Conclusion</h2>
<p>As you can see, there are a lot of choices when it comes to images on the web, and there is no end-all image format that should <em>always</em> be used. The truth of the matter is that your website visitors don&#8217;t care what format your images are in, they only care that they are downloaded in a timely fashion. In that spirit, images should be optimized for both speed and usability, regardless of the format.</p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/best-practices/best-practices-images-on-the-web/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

