<?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; XHTML</title>
	<atom:link href="http://kyleschaeffer.com/tag/xhtml/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>Taking it Down a Notch</title>
		<link>http://kyleschaeffer.com/best-practices/taking-it-down-a-notch/</link>
		<comments>http://kyleschaeffer.com/best-practices/taking-it-down-a-notch/#comments</comments>
		<pubDate>Sun, 12 Sep 2010 22:50:12 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://kyleschaeffer.com/?p=638</guid>
		<description><![CDATA[Bigger, better, and bolder. That&#8217;s the direction of things. The art of the interface is a little more complex than it was yesterday. We have new techniques, new technology (languages and libraries and acronyms, oh my), and even more bandwidth &#8230; <a href="http://kyleschaeffer.com/best-practices/taking-it-down-a-notch/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Bigger, better, and bolder. That&#8217;s the direction of things.  The art of the interface is a little more complex than it was yesterday.  We have new techniques, new technology (languages and libraries and acronyms, oh my), and even more bandwidth to back it all up.  What to do with all this power?  The possibilities are nearly limitless.  I say, <em>take it down a notch</em>.<span id="more-638"></span></p>
<h2>Let me explain&#8230;</h2>
<p>Now, don&#8217;t get me wrong.  I&#8217;m not suggesting that we participate in an exercise of mediocrity; quite the opposite, in fact.  I merely suggest that we take a step back and look at interface design on the web as a whole.  There&#8217;s something so beautiful about it, isn&#8217;t there?  Perhaps the beauty lies in the very nature of the web; a rare medium in which art and logic can collide.  As you well know, the fusion of these two seemingly opposing forces can sometimes end in a gruesome battle between form and function.  That simply shouldn&#8217;t be the case.</p>
<p>The form of an interface should support the application&#8217;s underlying function, and vice versa.  The battle that undoubtedly ensues between these two elements is ultimately what damages the design, and any compromise by either party can result only in mediocrity.  As the interface designer, it&#8217;s your job to cool the tempers on both sides of the development fence, and to facilitate a relationship that fosters that holy center ground, which at times can seem quite elusive and difficult to attain.</p>
<h2>A practice of simplicity</h2>
<p>The battle is set.  The warriors are ready to fight.  In the blue corner, Logic eyes its formless opponent with a cold-hearted certainty.  You are the mediator, and the time has come for you to tame your design into something everyone can be happy about.  Logic is your first adversary.  This is the underlying technology and function of your design.  It is simple and unforgiving.  Treat it as such.</p>
<p>In terms of design, this is the underlying <acronym title="HyperText Markup Language">HTML</acronym> and server-side functionality behind the pages.  It needs to be simple, semantic, accessible, and structured in a way that makes sense to the logic of your application.  Ask yourself with each snippet of markup that you type in, &#8220;What does this ultimately do?&#8221;  Think about the data of what you&#8217;re marking up, and not the appearance of it.  We&#8217;ll worry about the form of your design later.</p>
<h3 id="example-logo">A simple example</h3>
<p><img title="Site header and logo concept" src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2010/09/taking-it-down-logo.png" alt="Site header and logo concept" /></p>
<p>How would you implement your site&#8217;s logo?  Before you drop in an <code>&lt;img/&gt;</code> or a <code>&lt;div/&gt;</code>, think about what the logo <em>really</em> is.  What does it (logically) do?  In fact, it&#8217;s a header – it is used to describe or encapsulate the content below it.  Use the <code>&lt;h1/&gt;</code> tag – that&#8217;s what it&#8217;s for.  I don&#8217;t care about your silly logo or designer font.  My name is Logic, and I demand simplicity.  Give me what I want:</p>
<pre>&lt;h1 class="medazio-logo"&gt;Medazio: a completely made up word.&lt;/h1&gt;</pre>
<p>The visual appearance of our site header is not entirely simplistic, but the <acronym title="HyperText Markup Language">HTML</acronym> markup for it certainly is.</p>
<h3 id="example-comment">A little complexity, please</h3>
<p><img title="Site comments concept" src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2010/09/taking-it-down-comment.png" alt="Site comments concept" /></p>
<p>How would you implement a design for this comment?  As soon as you look at this image, it&#8217;s easy to see the layout, the colors, or even the position of the data.  Now, take a step back and remove the appearance of the image from your mind.  We&#8217;re working with the logic of the data, remember?  The position and orientation of the data simply doesn&#8217;t matter right now.  Don&#8217;t create classes like <strong>commentBottom</strong> – you&#8217;ll probably kick yourself later when you decide to switch things around a bit.  Use something more descriptive of the actual data contained in your markup, like <strong>comment-description</strong> or <strong>comment-meta</strong>.  In our case, we&#8217;ll do something very similar:</p>
<pre>&lt;ol class="comments"&gt;
  &lt;li class="comment <strong>hreview vcard item</strong>"&gt;
    &lt;p class="<strong>description</strong>"&gt;Lorem ipsum dolor...&lt;/p&gt;
    &lt;p class="comment-meta <strong>reviewer</strong>"&gt;
      &lt;img class="<strong>photo</strong>" src="/path/to/kyle.png" alt="Kyle" /&gt;
      &lt;a class="<strong>fn url</strong>" href="/profiles/kyle"&gt;Kyle&lt;/a&gt; @
      &lt;span class="<strong>dtreviewed</strong>" title="2010-02-18T21:49:38-07:00"&gt;
        Feb 18, 2010 9:49 pm
      &lt;/span&gt;
    &lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;</pre>
<p>Notice that we&#8217;ve used self-describing class names for most of the data within the comment.  The class names in <strong>bold</strong> are not required, but we&#8217;ve added them in order to adhere to the very useful <a href="http://microformats.org/wiki/hreview">hreview microformat</a>.  This helps define your data beyond what can be done with <acronym title="HyperText Markup Language">HTML</acronym> tags and attributes.  Additionally, we can append classes together to reduce the need to create extraneous style selectors later on.  Logic is now appeased.</p>
<h2>And in the red corner&#8230;</h2>
<p>Meet Art, an element of design not so easily defined as Logic.  Logic suffers without Art, its disobedient and relentlessly unpredictable counterpart.  It&#8217;s not &#8220;art&#8221; by any traditional sense of the word, no, but it is art nonetheless.  It&#8217;s bold and daring and difficult.  Art is what makes an interface attractive.  I dare not attempt to encapsulate the process by which one creates attractive design (it&#8217;s a creative process, after all), but I will dabble in the application of it.</p>
<p>Our tool for artistic application is the style sheet.  We will use <acronym title="Cascading Style Sheet">CSS</acronym> to infuse our structured <acronym title="HyperText Markup Language">HTML</acronym> with our creative ideas.  Using the aforementioned examples, let&#8217;s see how we can bring our flat and unforgiving concept images into interactive life.</p>
<h3>Making the header happen</h3>
<p>Remember the <a href="#example-logo">logo</a>?  Let&#8217;s take our cold-hearted <acronym title="HyperText Markup Language">HTML</acronym> and add some &#8220;fresh,&#8221; <acronym title="Cascading Style Sheet">CSS</acronym>-style.</p>
<pre>.medazio-logo {
   width: 223px;
   height: 31px;
   background: url(medazio-logo.png);
   text-indent: -9999px;
}</pre>
<p>We&#8217;re using image replacement to bump that pesky header text out of the way (make way, fabulous logo coming through).  The human eye is appeased by the appearance of our logo, and likewise the eye of the machine (search crawlers, screen readers, etc.) is equally appeased by the semantic structure of our <acronym title="HyperText Markup Language">HTML</acronym> document.  Even more exciting is the fact that our style sheet actually supports the logic of our design.  We&#8217;re achieving the appearance that our design demands without compromising the integrity of its structure or function.  Much rejoicing is in order.</p>
<h3>Adding style to our comments</h3>
<p>Similarly, let&#8217;s take the same approach with our <a href="#example-comment">comment <acronym title="HyperText Markup Language">HTML</acronym></a>:</p>
<pre>ol.comments {
   margin: 0;
   padding: 0;
}
li.comment {
   list-style: none;
   margin: 0 0 20px 0;
}
li.comment p.description {
   background: #f8f8f8;
   border-bottom: 4px solid #eee;
   margin: 0;
   padding: 20px;
}
li.comment p.comment-meta {
   background: url(chat-arrow.png) no-repeat 37px 0;
   padding: 5px 0 0 0;
}</pre>
<p>With a few simple lines of <acronym title="Cascading Style Sheet">CSS</acronym>, our sensationally semantic <acronym title="HyperText Markup Language">HTML</acronym> comment becomes exactly what we always dreamed it would be.  The best part?  Both the technology and the design of our application are meeting in the middle.  Better that than we, the designers, having to force the union in a rather rude and unsightly manner.</p>
<h2>You, the negotiator</h2>
<p>The cruel truth of the matter is that not every design element will be so simple or quite as easy to negotiate as this.  These are simple examples of a much bigger concept that takes time and practice to master.  You, as a designer, are the negotiator of both logic and art.  You are forced into a difficult role in which you must understand both the creative aspirations and the technical limitations of your project.  Most design professionals fall on either one side or the other of the art vs. technology skill-set.  Forcing yourself into an impartial role between the two is a difficult, yet imperative step in your journey to design bliss.</p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/best-practices/taking-it-down-a-notch/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Input Prompt Text:  A Better Way</title>
		<link>http://kyleschaeffer.com/best-practices/input-prompt-text/</link>
		<comments>http://kyleschaeffer.com/best-practices/input-prompt-text/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 02:43:37 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Text]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.kyleschaeffer.com/?p=565</guid>
		<description><![CDATA[It&#8217;s a very cool feature to have a form field that has prompt text such as Enter search keywords&#8230; right inside the input box, itself. It looks good, it makes sense to users, and it can save a lot of &#8230; <a href="http://kyleschaeffer.com/best-practices/input-prompt-text/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a very cool feature to have a form field that has prompt text such as <em>Enter search keywords&#8230;</em> right inside the input box, itself. It looks good, it makes sense to users, and it can save a lot of real estate in your design by negating the need for field labels. The problem, however, is that there are about one hundred ways to implement prompt text, and ninety-nine of them are wrong. Let&#8217;s look at this thing from all angles and come up with a fantastically simple and reliable way to make this work.<span id="more-565"></span></p>
<h2>What is input prompt text?</h2>
<p>You&#8217;re probably familiar with the concept, even if you don&#8217;t know what I&#8217;m talking about. Here&#8217;s an example:</p>
<p>
<input type="text" style="color: #999; font-style: italic; width: 250px;" value="Enter search keywords..." />
<input type="button" value="Search" /></p>
<p>The <em>prompt text</em> appears inside the form field as soon as the page loads, so users immediately know what it&#8217;s for. Simple, right?</p>
<h2>Why it Doesn&#8217;t Work</h2>
<p>There are a number of problems you&#8217;ll encounter while implementing prompt text into your forms. Watch out for these caveats when you&#8217;re developing your own solution.</p>
<ol>
<li><strong>Input validation</strong> &mdash; if someone submits the form without first removing the prompt text, your prompt text is submitted in lieu of real data. Fixing this is a pain. Avoiding this entirely is recommended.</li>
<li><strong>Prompt style</strong> &mdash; it&#8217;s best to style the prompt text so that it doesn&#8217;t look like real form data. Creativity is a virtue, but generally web users will expect light (gray) text and italics. This can be problematic because you&#8217;ll have to swap the input style back and forth using JavaScript.</li>
<li><strong>Losing focus</strong> &mdash; when users focus on a form field, don&#8217;t type anything, and then click somewhere else, you should always add the prompt text <em>back into the input box</em>.  Otherwise, users could miss the intent of the form field entirely.  Again, you&#8217;ll have to do this with JavaScript, which can be a little tricky.</li>
<li><strong>Progressive enhancement</strong> &mdash; always make sure that users without JavaScript can still understand and interact with your form fields. This is progressive enhancement at its finest.</li>
</ol>
<h2>The Solution</h2>
<p>Almost everything related to the problems listed above originates from one basic fact: you&#8217;re trying to create both a <strong>field</strong> and a <strong>label</strong> using a single HTML element. When you take a step back and think about that, it really doesn&#8217;t make much sense, does it? The solution lies in separating the form field from the label entirely. We&#8217;ll use a little bit of jQuery to create an elegant solution that dynamically creates these labels and places them over our form fields. Because we&#8217;re creating two separate elements, we can use CSS to style them independently. Perfect!</p>
<p><strong>The jQuery:</strong></p>
<pre>$(document).ready(function(){
  $('input[type=text][title],input[type=password][title],textarea[title]').each(function(i){
    $(this).addClass('input-prompt-' + i);
    var promptSpan = $('&lt;span class=&quot;input-prompt&quot;/&gt;');
    $(promptSpan).attr('id', 'input-prompt-' + i);
    $(promptSpan).append($(this).attr('title'));
    $(promptSpan).click(function(){
      $(this).hide();
      $('.' + $(this).attr('id')).focus();
    });
    if($(this).val() != ''){
      $(promptSpan).hide();
    }
    $(this).before(promptSpan);
    $(this).focus(function(){
      $('#input-prompt-' + i).hide();
    });
    $(this).blur(function(){
      if($(this).val() == ''){
        $('#input-prompt-' + i).show();
      }
    });
  });
});</pre>
<p><strong>The CSS:</strong></p>
<pre>.input-prompt {
  position: absolute;
  font-style: italic;
  color: #aaa;
  margin: 0.2em 0 0 0.5em;
}</pre>
<p><strong>The HTML:</strong></p>
<pre>&lt;input type=&quot;text&quot; <strong>title=&quot;Enter search keywords...&quot;</strong> /&gt;</pre>
<p>Basically, this script finds any <code>&lt;input&gt;</code> tags that have a <code>title</code> attribute (i.e. <code>&lt;input title=&quot;Enter search keywords...&quot; /&gt;</code>). For each of these form fields, it takes the <code>title</code> and creates a little <code>&lt;span&gt;</code> tag next to it. The CSS positions the <code>&lt;span&gt;</code> tag so that it appears <em>on top</em> of the form field. The rest is just a little bit of scripting that makes sure to hide and show the labels based on what the user is doing with the input box.</p>
<h2>The Result</h2>
<p>Here is a demo of the code shown above:</p>
<p><script type="text/javascript">jQuery(document).ready(function(){
  jQuery('input#demo').each(function(i){
    jQuery(this).addClass('input-prompt-' + i);
    var promptSpan = jQuery('<span class="input-prompt"/>');
    jQuery(promptSpan).attr('id', 'input-prompt-' + i);
    jQuery(promptSpan).append(jQuery(this).attr('title'));
    jQuery(promptSpan).click(function(){
      jQuery(this).hide();
      jQuery('.' + jQuery(this).attr('id')).focus();
    });
    if(jQuery(this).val() != ''){
      jQuery(promptSpan).hide();
    }
    jQuery(this).before(promptSpan);
    jQuery(this).focus(function(){
      jQuery('#input-prompt-' + i).hide();
    });
    jQuery(this).blur(function(){
      if(jQuery(this).val() == ''){
        jQuery('#input-prompt-' + i).show();
      }
    });
  });
});</script><br />
<style type="text/css">.input-prompt { position: absolute; font-style: italic; color: #aaa; margin: 0.7em 0 0 1em; }</style>
<input id="demo" type="text" title="Enter search keywords..." size="50" style="padding: 0.5em;" />
<p>Users without JavaScript enabled will see the normal title tool tips when they hover their mouse cursor over the form field.  Please note that you&#8217;ll probably have to adjust the <code>margin</code> a bit in the CSS to make sure the labels fit the size of your input boxes. For more information on jQuery and all the great things it can do, visit <a href="http://jquery.com/">jQuery.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/best-practices/input-prompt-text/feed/</wfw:commentRss>
		<slash:comments>33</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>A Simple jQuery Tabs Template</title>
		<link>http://kyleschaeffer.com/web-controls/simple-jquery-tabs-template/</link>
		<comments>http://kyleschaeffer.com/web-controls/simple-jquery-tabs-template/#comments</comments>
		<pubDate>Thu, 22 Oct 2009 14:47:28 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Web Controls]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DHTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tabs]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.kyleschaeffer.com/?p=348</guid>
		<description><![CDATA[I love jQuery; I use it all the time. I also love the great UI controls that come with the jQuery UI library. Unfortunately, I&#8217;ve found that a lot of these controls can be a little heavy in terms of &#8230; <a href="http://kyleschaeffer.com/web-controls/simple-jquery-tabs-template/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I love <a href="http://jquery.com/">jQuery</a>; I use it all the time. I also love the great UI controls that come with the <a href="http://jqueryui.com/">jQuery UI</a> library. Unfortunately, I&#8217;ve found that a lot of these controls can be a little heavy in terms of required JS/CSS files that your clients will have to download in order to use these controls. Being the minimalist that I am, I really want to drop a small amount of CSS and HTML into my site and quickly get myself up and running with a tab structure that&#8217;s both flexible and accessible.<span id="more-348"></span></p>
<h2>Adding jQuery is Easy</h2>
<p>You&#8217;ll need to include a few JavaScript libraries in order to use jQuery tabs at all. These libraries can be somewhat cumbersome for users on slower connections to download, and it&#8217;s definitely the major disadvantage of using a library like jQuery to add this sort of functionality to your site. The best things we can do in this case is try to minimize the effect of serving this JS library to our clients. First of all, I would recommend always using the &#8220;minified&#8221; version of the jQuery script. It&#8217;s much smaller in size than the standard version, which obviously will reduce the amount of time needed to load your site when users first visit it. The only difference between the minified and the standard library is that the good folks at jQuery have removed all sorts of characters in the document, which makes it less readable, but makes the file size much smaller. If you want to delve into the depths of the jQuery library, you can download the standard version and take a gander offline, but don&#8217;t force your users to download the full version if you don&#8217;t have to.</p>
<p>Additionally, Google (<a href="http://code.google.com/apis/ajaxlibs/documentation/#jquery">here</a>) and Microsoft (<a href="http://www.asp.net/ajax/CDN/">here</a>) have both set up distribution networks to serve these libraries to your users. Don&#8217;t waste bandwidth and your clients&#8217; time by forcing users to download these libraries from your servers! Chances are, Google/Microsoft have the resources to serve these files to you users faster and more reliably than you can, so please utilize these free services. Additionally, users have a much greater chance of already having a cached version of these files when you used the shared location. Sweet!</p>
<p>Add the library references to your <code>&lt;head/&gt;</code> to get started.</p>
<pre>&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://jqueryui.com/latest/ui/ui.tabs.js&quot;&gt;&lt;/script&gt;</pre>
<h2>The Tabs Markup</h2>
<p>What&#8217;s so wonderfully beautiful about jQuery tabs is the simplicity of the HTML. Even more, users who aren&#8217;t using JavaScript will visit your site and see a perfectly formatted and functioning page. Use this as a template for your tabs HTML:</p>
<pre>&lt;div class=&quot;ui-tabs&quot;&gt;
	&lt;ul class=&quot;ui-tabs-nav&quot;&gt;
		&lt;li&gt;&lt;a href=&quot;#tabs-1&quot;&gt;Tab One&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;#tabs-2&quot;&gt;Tab Two&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;#tabs-3&quot;&gt;Tab Three&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
	&lt;div id=&quot;tabs-1&quot; class=&quot;ui-tabs-panel&quot;&gt;
		&lt;p&gt;Content one.&lt;/p&gt;
	&lt;/div&gt;
	&lt;div id=&quot;tabs-2&quot; class=&quot;ui-tabs-panel&quot;&gt;
		&lt;p&gt;Content two.&lt;/p&gt;
	&lt;/div&gt;
	&lt;div id=&quot;tabs-3&quot; class=&quot;ui-tabs-panel&quot;&gt;
		&lt;p&gt;Content three.&lt;/p&gt;
	&lt;/div&gt;
&lt;/div&gt;</pre>
<h2>Add Some Style</h2>
<p>This is where my template really starts to differ from jQuery&#8217;s version. The CSS jQuery would have you use is not simple enough for me, so I created my own version of the CSS that will give you a very basic frame onto which you can apply your own design. Here&#8217;s what I like to start with:</p>
<pre>.ui-tabs {
	zoom: 1;
}
.ui-tabs .ui-tabs-nav {
	list-style: none;
	position: relative;
	padding: 0;
	margin: 0;
}
.ui-tabs .ui-tabs-nav li {
	position: relative;
	float: left;
	margin: 0 3px -2px 0;
	padding: 0;
}
.ui-tabs .ui-tabs-nav li a {
	display: block;
	padding: 10px 20px;
	background: #f0f0f0;
	border: 2px #ccc solid;
	border-bottom-color: #ccc;
	outline: none;
}
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a {
	padding: 10px 20px 12px 20px;
	background: #fff;
	border-bottom-style: none;
}
.ui-tabs .ui-tabs-nav li.ui-tabs-selected a,
.ui-tabs .ui-tabs-nav li.ui-state-disabled a,
.ui-tabs .ui-tabs-nav li.ui-state-processing a {
	cursor: default;
}
.ui-tabs .ui-tabs-nav li a,
.ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a {
	cursor: pointer;
}
.ui-tabs .ui-tabs-panel {
	display: block;
	clear: both;
	border: 2px #ccc solid;
	padding: 10px;
}
.ui-tabs .ui-tabs-hide {
	display: none;
}</pre>
<h2>Now Make it Do Something</h2>
<p>Now that you have your tabs there, you&#8217;ll have to initialize them with a simple jQuery statement in order for them to work. Just add this line of JavaScript anywhere on your page.</p>
<pre>&lt;script type=&quot;text/javascript&quot;&gt;
	$(document).ready(function(){
		$(&quot;.ui-tabs&quot;).tabs();
	});
&lt;/script&gt;</pre>
<h2>The Result</h2>
<p>Once you&#8217;ve added each of these elements to your page, you should get a very simple tab structure that awaits your styling genius. Just modify the CSS to apply your own design!</p>
<div class="ui-tabs">
<ul class="ui-tabs-nav">
<li><a href="#tabs-1">Tab One</a></li>
<li><a href="#tabs-2">Tab Two</a></li>
<li><a href="#tabs-3">Tab Three</a></li>
</ul>
<div id="tabs-1" class="ui-tabs-panel">
<p>Content one.</p>
</div>
<div id="tabs-2" class="ui-tabs-panel">
<p>Content two.</p>
</div>
<div id="tabs-3" class="ui-tabs-panel">
<p>Content three.</p>
</div>
</div>
<p><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script><script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.tabs.js"></script><script type="text/javascript">$(document).ready(function(){$(".ui-tabs").tabs();});</script><br />
<style type="text/css">#content .ui-tabs { zoom: 1; }
#content .ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: 0; margin: 0; }
#content .ui-tabs .ui-tabs-nav li { list-style: none; position: relative; float: left; margin: 0 3px -2px 0; padding: 0; }
#content .ui-tabs .ui-tabs-nav li a { display: block; padding: 10px 20px; background: #f0f0f0; border: 2px #ccc solid; border-bottom-color: #ccc; outline: none; }
#content .ui-tabs .ui-tabs-nav li.ui-tabs-selected a { padding: 10px 20px 12px 20px; background: #fff; border-bottom-style: none; }
#content .ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: default; }
#content .ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; }
#content .ui-tabs .ui-tabs-panel { display: block; clear: both; border: 2px #ccc solid; padding: 10px; }
#content .ui-tabs .ui-tabs-hide { display: none; }</style>
<p>Now you&#8217;ve got it. Good luck, and happy styling.</p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/web-controls/simple-jquery-tabs-template/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Reusable Transparent CSS Rounded Corners</title>
		<link>http://kyleschaeffer.com/best-practices/reusable-transparent-css-rounded-corners/</link>
		<comments>http://kyleschaeffer.com/best-practices/reusable-transparent-css-rounded-corners/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 21:45:09 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Corners]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.kyleschaeffer.com/?p=296</guid>
		<description><![CDATA[In retrospective, there are definitely some areas where I could have improved on my Karate Corners design. I decided to take a second look and write a quick post that details how I create corners today, after almost a year &#8230; <a href="http://kyleschaeffer.com/best-practices/reusable-transparent-css-rounded-corners/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In retrospective, there are definitely some areas where I could have improved on my <a href="http://www.kyleschaeffer.com/tutorials/karate-corners-easy-rounded-corners-xhtml-no-script/">Karate Corners</a> design. I decided to take a second look and write a quick post that details how I create corners today, after almost a year of evolution in the ever-changing world of web design. This is absolutely the most simple and efficient way to create rounded corners using strictly CSS and HTML.<span id="more-296"></span></p>
<p>Rounded corners are all the rage; they have been for some time now. There are <a href="http://www.kyleschaeffer.com/best-practices/rounded-corners-in-mozilla-and-safari/">pure CSS</a> approaches to implementing this type of design, but occasionally your clients demand that your user experience be consistent across all browsers. Whether it&#8217;s time to stop using HTML and images for rounded corners is still a <a href="http://www.kyleschaeffer.com/best-practices/a-whole-new-web/">matter of debate</a>. Nonetheless, I think every designer finds themselves doing this from time to time.</p>
<h2>Say No to Images</h2>
<p>I&#8217;ve found that many designs contain various types of rounded box styles on the same page. In my previous tutorial, this would demand that you create a separate corner image for each style of box. If you have a box with a red background, you&#8217;ll need to create a corner image with red corners. That makes sense from a visual perspective. From a data perspective, however, it&#8217;s not the best approach. If you think about it, the only thing you&#8217;re really &#8220;downloading&#8221; when you download a corner image is the curvature of your box&#8217;s edge. Wouldn&#8217;t it be better if we could somehow reuse that data on every box style everywhere else in your design?</p>
<p>Well, you can! How gloriously fantastic! Well&#8230;don&#8217;t get all excited just yet. There are a few limitations to this. <strong>This will only work when your rounded box appears on a solid color.</strong> For instance, the text you&#8217;re reading right now is on a solid white background. We can easily add rounded boxes to this page because of the solid color. This doesn&#8217;t really work if your background is an image or a gradient color.</p>
<h2>Meet the Sprite</h2>
<p>So, you have a solid background color, and you&#8217;re ready to add some rounded corner boxes to your page. The only really important thing here is your corners image. In Photoshop or an image editing software of your choice, create a square image. Basically, your image is all four box corners stuck together, so make it symmetrical. Fill your image with the background color of your page, and then delete a circle out of the middle of the square. It&#8217;s that easy! Here&#8217;s what it should look like when you&#8217;re done:</p>
<p><img src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2009/09/TransparentCorners.png" alt="Transparent Corners Image" /></p>
<p>In case you&#8217;re not Photoshop-savvy, I have created a few templates that you can download and use.</p>
<ul>
<li><a href="http://www.kyleschaeffer.com/wordpress/wp-content/uploads/2009/09/TransparentCorners-10.psd">TransparentCorners-10.psd</a> &#8211; 10&#215;10 pixel corner image template</li>
<li><a href="http://www.kyleschaeffer.com/wordpress/wp-content/uploads/2009/09/TransparentCorners-15.psd">TransparentCorners-15.psd</a> &#8211; 15&#215;15 pixel corner image template</li>
<li><a href="http://www.kyleschaeffer.com/wordpress/wp-content/uploads/2009/09/TransparentCorners-20.psd">TransparentCorners-20.psd</a> &#8211; 20&#215;20 pixel corner image template</li>
</ul>
<h2>The Markup</h2>
<p>Now that we have this nice fancy reusable transparent corner image, it&#8217;s time to create the HTML that will be used to house our beautiful box and its contents. Here&#8217;s the basic setup:</p>
<pre>&lt;div class="box red"&gt;
	&lt;div class="corner TL"&gt;&lt;/div&gt;
	&lt;div class="corner TR"&gt;&lt;/div&gt;
	&lt;div class="corner BL"&gt;&lt;/div&gt;
	&lt;div class="corner BR"&gt;&lt;/div&gt;
	&lt;p&gt;This is your box content. Lorem ipsum dolor sit amet.&lt;/p&gt;
&lt;/div&gt;</pre>
<p>Pretty simple, right? We have an outer &#8220;box&#8221; <code>&lt;div/&gt;</code>, a <code>&lt;div/&gt;</code> for each corner, and then our content that will appear inside the box.</p>
<h2>The Style</h2>
<p>Our HTML doesn&#8217;t do much by itself. Most of the work to be done is going to be done in our CSS style sheet. In an attached style sheet, add the following CSS:</p>
<pre>.box {
	position: relative;
	padding: 1em;
}
.red {
	background: #cc0000;
	color: #fff;
}
.corner {
	position: absolute;
	width: 10px;
	height: 10px;
	background: url(/path/to/cornerImage.png) no-repeat;
}
.TL {
	top: 0;
	left: 0;
	background-position: 0 0;
}
.TR {
	top: 0;
	right: 0;
	background-position: 100% 0;
}
.BL {
	bottom: 0;
	left: 0;
	background-position: 0 100%;
}
.BR {
	bottom: 0;
	right: 0;
	background-position: 100% 100%;
}</pre>
<p>As you can see, we&#8217;re really trying to keep this simple. Basically, we have an outer &#8220;box&#8221; style, a &#8220;red&#8221; style that sets the box&#8217;s background color to red, and finally individual &#8220;corner&#8221; styles that will automatically position themselves at the edges of our content, regardless of the height/width of that content. Groovy.</p>
<h2>The Result</h2>
<p>I&#8217;ve created a simple &#8220;white&#8221; background corner image for use on this page. What you get when you put all of this together is a very flexible corner system that requires very little HTML and CSS to implement:</p>
<style type="text/css">.box { position: relative; padding: 1em; margin: 0 0 1em 0; } .red { background: #cc0000; color: #fff; } .corner { position: absolute; width: 20px; height: 20px; background: url(/wordpress/wp-content/uploads/2010/09/cornersWhite.png) no-repeat; } .TL { top: 0; left: 0; background-position: 0 0; } .TR { top: 0; right: 0; background-position: 100% 0; } .BL { bottom: 0; left: 0; background-position: 0 100%; } .BR { bottom: 0; right: 0; background-position: 100% 100%; }</style>
<div class="box red">
<div class="corner TL"></div>
<div class="corner TR"></div>
<div class="corner BL"></div>
<div class="corner BR"></div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque justo felis, molestie rutrum blandit vitae, pellentesque vitae risus. Nunc hendrerit eleifend lectus. Aenean interdum facilisis sem eget laoreet. Morbi in nisl nec neque auctor volutpat. Nam sodales felis id magna cursus ac pretium libero mollis.
</p></div>
<p>And the coolest part&#8230;</p>
<h2>It&#8217;s Reusable!</h2>
<p>The coolest part about using transparent images for our corners is that we can apply these corners to just about anything on our page that we want to. For instance, I could create some additional box styles (other than &#8220;red&#8221;) by adding a bit of CSS.</p>
<pre>.red {
	background: #cc0000;
	color: #fff;
}
.blue {
	background: #00cc00;
	color: #fff;
}
.green {
	background: #0000cc;
	color: #fff;
}
.gray {
	background: #dedede;
	color: #666;
}</pre>
<p>After changing our box&#8217;s class (<code>class="box blue"</code>, <code>class="box green"</code>, etc.), we would get:</p>
<style type="text/css">.blue { background: #00cc00; color: #fff; } .green { background: #0000cc; color: #fff; } .gray { background: #dedede; color: #666; } .oneThird { float: left; width: 31.3%; margin: 0 2% 0 0; } .oneThirdBottom { clear: both; }</style>
<div class="oneThird">
<div class="box red">
<div class="corner TL"></div>
<div class="corner TR"></div>
<div class="corner BL"></div>
<div class="corner BR"></div>
<p>Suspendisse potenti. Morbi eget turpis urna. Fusce tincidunt sem mollis lacus euismod rhoncus sagittis est placerat.</p>
<p>&nbsp;</p>
</div>
</div>
<div class="oneThird">
<div class="box blue">
<div class="corner TL"></div>
<div class="corner TR"></div>
<div class="corner BL"></div>
<div class="corner BR"></div>
<p>Suspendisse potenti. Morbi eget turpis urna. Fusce tincidunt sem mollis lacus euismod rhoncus sagittis est placerat.</p>
<p>&nbsp;</p>
</div>
</div>
<div class="oneThird">
<div class="box green">
<div class="corner TL"></div>
<div class="corner TR"></div>
<div class="corner BL"></div>
<div class="corner BR"></div>
<p>Suspendisse potenti. Morbi eget turpis urna. Fusce tincidunt sem mollis lacus euismod rhoncus sagittis est placerat.</p>
<p>&nbsp;</p>
</div>
</div>
<div class="box gray" style="clear: both;">
<div class="corner TL"></div>
<div class="corner TR"></div>
<div class="corner BL"></div>
<div class="corner BR"></div>
<p>Gray is the new &#8220;red&#8221;. Vestibulum iaculis varius laoreet. Ut et condimentum nunc. Suspendisse eleifend congue dolor, non consequat ante tristique sit amet.</p>
</div>
<p>That&#8217;s really cool, but this doesn&#8217;t even touch the limits of how you can apply this. In addition to solid color boxes, we could also apply this to photos and gradients (which would be much harder in a more traditional corner system). Our corners really don&#8217;t care what type of content they&#8217;re applied on, they only really care about the background color. Let&#8217;s try it out on some different page elements (accompanying HTML and CSS are included for each style):</p>
<h2>The Mini Profile</h2>
<h3>HTML:</h3>
<pre>&lt;div class="box photo"&gt;
	&lt;div class="corner TL"&gt;&lt;/div&gt;
	&lt;div class="corner TR"&gt;&lt;/div&gt;
	&lt;div class="corner BL"&gt;&lt;/div&gt;
	&lt;div class="corner BR"&gt;&lt;/div&gt;
	&lt;h3&gt;My Profile&lt;/h3&gt;
	&lt;img src="kyle.jpg" alt="Me" /&gt;
&lt;/div&gt;</pre>
<h3>CSS:</h3>
<pre class="brush:css">.photo {
	width: 200px;
	padding: 0;
}
.photo h3 {
	background: #000;
	color: #fff;
	padding: 10px 20px;
	margin: 0;
	font-size: 1em;
}</pre>
<style type="text/css">.myPhoto { width: 200px; padding: 0; } .myPhoto h3 { background: #000; color: #fff; padding: 10px 20px; margin: 0; font-size: 1em; }</style>
<div class="box myPhoto">
<div class="corner TL"></div>
<div class="corner TR"></div>
<div class="corner BL"></div>
<div class="corner BR"></div>
<h3>My Profile</h3>
<p><img style="padding: 0; border: 0; margin: 0;" src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2008/10/kyle.jpg" alt="Me" /></div>
<h2>The Gradient</h2>
<h3>HTML:</h3>
<pre>&lt;div class="box blueGradient"&gt;
	&lt;div class="corner TL"&gt;&lt;/div&gt;
	&lt;div class="corner TR"&gt;&lt;/div&gt;
	&lt;div class="corner BL"&gt;&lt;/div&gt;
	&lt;div class="corner BR"&gt;&lt;/div&gt;
	&lt;p&gt;Notice the gradient background image!&lt;/p&gt;
&lt;/div&gt;</pre>
<h3>CSS:</h3>
<pre>.blueGradient {
	background: url(gradient-image.png) repeat-x;
	color: #fff;
}</pre>
<style type="text/css">.blueGradient { background: #a9e4f7; background: -moz-linear-gradient(top, #a9e4f7 0%, #0fb4e7 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#a9e4f7), color-stop(100%,#0fb4e7)); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#a9e4f7', endColorstr='#0fb4e7',GradientType=0 ); background: -o-linear-gradient(top, #a9e4f7 0%,#0fb4e7 100%); }</style>
<div class="box blueGradient">
<div class="corner TL"></div>
<div class="corner TR"></div>
<div class="corner BL"></div>
<div class="corner BR"></div>
<p>Notice the gradient background image! Lorem ipsum dolor sit amet, consectetur adipiscing elit. In facilisis posuere purus, vitae sagittis enim sodales at. Proin in purus et metus vestibulum cursus. Vivamus volutpat dolor quis lectus cursus et lobortis felis iaculis. Aenean ut enim magna, sit amet convallis mi. In hac habitasse platea dictumst. In hac habitasse platea dictumst.</p>
</div>
<p>We&#8217;ve accomplished all of the styles you see above using a single image and some fancy CSS footwork. This really minimizes the impact of your corners on page download times, especially if you&#8217;re using a number of different styles on a single background color. No scripts, no confusing HTML, simple markup, and a single image. Happy styling.</p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/best-practices/reusable-transparent-css-rounded-corners/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>A Very Simple CSS Chat Bubble</title>
		<link>http://kyleschaeffer.com/tutorials/a-very-simple-css-chat-bubble/</link>
		<comments>http://kyleschaeffer.com/tutorials/a-very-simple-css-chat-bubble/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 13:38:19 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.kyleschaeffer.com/?p=293</guid>
		<description><![CDATA[Each time you implement a new design element into your site, there are a vast array of approaches you can take to achieve the same outcome. Often times, I feel that the most simple of solutions is the best one. &#8230; <a href="http://kyleschaeffer.com/tutorials/a-very-simple-css-chat-bubble/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Each time you implement a new design element into your site, there are a vast array of approaches you can take to achieve the same outcome. Often times, I feel that the <a href="http://www.kyleschaeffer.com/best-practices/the-wisdom-of-simplicity/">most simple of solutions</a> is the best one. When implementing the &#8220;user comments&#8221; feature into <a href="http://thumbsticks.com">ThumbSticks.com</a>, I decided to wrap each user comment in a sort of &#8220;chat bubble box,&#8221; much like you would see in a comic book story. I experimented with various solutions that gave me different amounts of flexibility and performance, but I eventually settled on a very simple solution that resulted in what I think is an elegant CSS chat bubble.<span id="more-293"></span></p>
<h2>The Idea</h2>
<p>First of all, I will say that <strong>this approach only really works if you know the maximum size of your comment data</strong>. On ThumbSticks.com, for instance, users can&#8217;t enter comments that are over 300 characters in length, so I have a good idea of how large each comment box could possibly get. Rather than splicing my comment box into multiple images (which is more flexible, but decreases page performance and increases download times), I decided to create a single image that is used to wrap each comment chat bubble:</p>
<h3>The Image</h3>
<p><img src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2009/09/commentBg.png" alt="Comment Chat Bubble" width="477" height="300" /></p>
<p>Basically, my chat bubble boxes can shrink to any size, but they can&#8217;t grow beyond the height of this image. If you know exactly how large your data can get, this is a really simple solution to implement. All that I need to show my chat bubbles is a bit of HTML and CSS.</p>
<h2>The Nitty-Gritty</h2>
<h3>HTML:</h3>
<pre>&lt;div class=&quot;bubble&quot;&gt;
	&lt;div class=&quot;bubbleHeader&quot;&gt;&lt;/div&gt;
	&lt;div class=&quot;bubbleInner&quot;&gt;
		&lt;p&gt;Lorem ipsum dolor sit amet.&lt;/p&gt;
	&lt;/div&gt;
&lt;/div&gt;</pre>
<h3>CSS:</h3>
<pre>.bubble {
	width: 477px;
	background: url('/path/to/commentBg.png') no-repeat;
	background-position: 100% 100%;
}
.bubbleHeader {
	height: 20px;
	background: url('/path/to/commentBg.png') no-repeat;
	background-position: 100% 0;
}
.bubbleInner {
	padding: 0 20px 10px 37px;
}</pre>
<p>Make sure you change &#8220;/path/to/comment.Bg.png&#8221; to reflect the actual path to the background image you&#8217;re using. Once you&#8217;ve dropped this into your design, you should see something that <a href="http://thumbsticks.com/games/xbox-360/call-of-duty-world-at-war">looks a little like this</a>.</p>
<p>Good luck, and happy styling!</p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/tutorials/a-very-simple-css-chat-bubble/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>The Wisdom of Simplicity</title>
		<link>http://kyleschaeffer.com/best-practices/the-wisdom-of-simplicity/</link>
		<comments>http://kyleschaeffer.com/best-practices/the-wisdom-of-simplicity/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 18:38:11 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.kyleschaeffer.com/?p=237</guid>
		<description><![CDATA[Web designers would be wise to approach every situation with one thing in mind: simplicity. Simplicity is the cornerstone of designing a well-structured and highly flexible HTML/CSS design. I&#8217;ve found that all too often, many designers approach a website with &#8230; <a href="http://kyleschaeffer.com/best-practices/the-wisdom-of-simplicity/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Web designers would be wise to approach every situation with one thing in mind: simplicity. Simplicity is the cornerstone of designing a well-structured and highly flexible HTML/CSS design. I&#8217;ve found that all too often, many designers approach a website with one thing in mind: the &#8220;look&#8221; of the fully rendered site. They approach each page or screen with a definitive pixel-perfect image in their heads, and they execute the design process to produce each pixel as it was originally intended.<span id="more-237"></span></p>
<p>The truth of the matter is that a web document is a compilation of various highly organized computer languages (XML, HTML, CSS, JavaScript, etc.). The web designer has the difficult task of considering the &#8220;art&#8221; of the design as well as the technical architecture of it. A truly skilled web designer has the ability to think both creatively and logically.  A designer bridges the gap between design and development, which is sometimes a very difficult task; a task made far more feasible by the utilization of simplicity.</p>
<h2>A Simple Example</h2>
<p>I use the word &#8220;simplicity&#8221; in a very generic sense; it&#8217;s a very broad term, so I&#8217;d like to use a few examples to show how simplicity can be a great aid in web design.  Take, for instance, the anchor tag (<code>&lt;a/&gt;</code>).  The anchor tag is at the very foundation of HTML; it is the most basic implementation of the concept of the internet:  the hyperlink.  It&#8217;s so simple in and of itself, how could designers possibly do anything at all to mar it&#8217;s glorious simplicity?</p>
<p><strong>Here are two anchor tags.  They appear quite identical, but the behavior of each is remarkably different.  Which one is better?</strong></p>
<style type="text/css">	.complexLink { display: block; width: 15em; padding: 1em 0; margin: 0 2em 2em 0; float: left; background: #f0f0f0; border: 1px #e0e0e0 solid; -moz-border-radius: 1em; -webkit-border-radius: 1em; text-align: center; }
.complexLink:hover { border-color: #c0c0c0; }
.complexLink a { color: #555; }
.complexLink a:hover { color: #d56e1c; text-decoration: none; }
.simpleLink { display: block; width: 15em; padding: 1em 0; margin: 0 2em 2em 0; float: left; background: #f0f0f0; color: #555; border: 1px #e0e0e0 solid; -moz-border-radius: 1em; -webkit-border-radius: 1em; text-align: center; }
.simpleLink:hover { color: #d56e1c; border-color: #c0c0c0; text-decoration: none; }
</style>
<p><span class="complexLink"><a href="javascript:alert('The art of art, the glory of expression and the sunshine of the light of letters, is simplicity.\n~ Walt Whitman');">A Simple Link</a></span> <a class="simpleLink" href="javascript:alert('Design is not just what it looks like and feels like. Design is how it works.\n~ Steve Jobs');">A Simple Link</a></p>
<div style="clear: both;">&nbsp;</div>
<p>Did you notice a difference? At first glance, they are identical, but the interactive behavior of each link is quite different. Move your mouse cursor over each link, and notice the difference in clickable area on each link. On the first anchor tag, only the text &#8220;A Simple Link&#8221; is hyperlinked. The padded area around the link is not. The second link, however, is fully hyperlinked (the entire padded area is clickable).</p>
<h2>Visual Interactivity</h2>
<p>This is a demonstration of the fundamental elements of simplicity in design. A user who visits your site doesn&#8217;t care how you&#8217;ve formatted your CSS and HTML, or how you&#8217;ve scripted page behavior to allow for access to your data. The user only cares about navigating to the content they&#8217;re interested in. When a user sees a visual element on the page (such as the links above), they want to move their mouse pointer to that element and click. If a particular page element has some level of interactive behavior associated with it, the <em>entire element</em> should react to that behavior.</p>
<h2>Logical Simplicity</h2>
<p>Treating page elements in this fashion can also help eliminate extraneous HTML and CSS. Again, using the example above, let&#8217;s look at the source code of these two different links and examine their differences.</p>
<div style="width: 45%; margin: 0 4% 0 0; float: left;">
<h3>Scenario 1 (Complex)</h3>
<pre>&lt;style type=&quot;text/css&quot;&gt;
.complexLink {
	display: block;
	width: 15em;
	padding: 1em 0;
	margin: 0 2em 2em 0;
	float: left;
	background: #f0f0f0;
	border: 1px #e0e0e0 solid;
	-moz-border-radius: 1em;
	-webkit-border-radius: 1em;
	text-align: center;
}
.complexLink:hover {
	border-color: #c0c0c0;
}
.complexLink a {
	color: #555;
}
.complexLink a:hover {
	color: #d56e1c;
	text-decoration: none;
}
&lt;/style&gt;
&lt;span class=&quot;complexLink&quot;&gt;&lt;a href=&quot;...&quot;&gt;A Simple Link&lt;/a&gt;&lt;/span&gt;</pre>
</div>
<div style="width: 45%; margin: 0 4% 0 0; float: left;">
<h3>Scenario 2 (Simple)</h3>
<pre>&lt;style type=&quot;text/css&quot;&gt;
.simpleLink {
	display: block;
	width: 15em;
	padding: 1em 0;
	margin: 0 2em 2em 0;
	float: left;
	background: #f0f0f0;
	color: #555;
	border: 1px #e0e0e0 solid;
	-moz-border-radius: 1em;
	-webkit-border-radius: 1em;
	text-align: center;
}
.simpleLink:hover {
	color: #d56e1c;
	border-color: #c0c0c0;
	text-decoration: none;
}
&lt;/style&gt;
&lt;a class=&quot;simpleLink&quot; href=&quot;...&quot;&gt;A Simple Link&lt;/a&gt;</pre>
</div>
<div class="clear"></div>
<p>The code above relates to the first and second links, respectively. At first, the two links seemed almost identical, but now the differences are really starting to show. Not only is our more complex example (the first link) more difficult for the user to interpret, but it&#8217;s also more work for you as the designer because you have more elements, layers, and styles to deal with.</p>
<h2>Now Repeat</h2>
<p>It might be somewhat trivial to look at an anchor tag in such depth, but this type of design methodology extends into every aspect of web development. From HTML to CSS, from JavaScript to server-side programming, simplicity is an essential element of a good design. You&#8217;ll find that adopting this mentality can increase your productivity, lower the costs of site re-design, and expedite efforts to troubleshoot and resolve rendering problems in your web application. Less really <em>is</em> more.</p>
<p>Take a moment, take your time, and think about each and every element that you design as an independent function of logic and art. Think about the best way to approach every control, and apply uncompromising simplicity wherever possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/best-practices/the-wisdom-of-simplicity/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CSS Absolute Positioning</title>
		<link>http://kyleschaeffer.com/best-practices/css-absolute-positioning/</link>
		<comments>http://kyleschaeffer.com/best-practices/css-absolute-positioning/#comments</comments>
		<pubDate>Mon, 06 Apr 2009 15:56:36 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Positioning]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.kyleschaeffer.com/?p=201</guid>
		<description><![CDATA[Absolute positioning is a very powerful CSS technique when used properly. Traditionally, when you use &#60;div/&#62; tags and the like, everything in your page design is generally stacked from top to bottom. Using absolute positioning gives you the freedom to &#8230; <a href="http://kyleschaeffer.com/best-practices/css-absolute-positioning/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Absolute positioning is a very powerful CSS technique when used properly.  Traditionally, when you use <code>&lt;div/&gt;</code> tags and the like, everything in your page design is generally stacked from top to bottom.  Using absolute positioning gives you the freedom to place elements of your page just about anywhere you&#8217;d like.  Here are some fundamentals of absolute positioning that can make your design appear more fluid, elegant, and easier to manage.<span id="more-201"></span></p>
<h2>What is absolute positioning?</h2>
<p>Absolute positioning can be frustrating if you don&#8217;t have a sound grasp on what it is and how it works.  Let&#8217;s start at the very beginning.</p>
<p>Every block element on a page (<code>&lt;div/&gt;</code>, <code>&lt;table/&gt;</code>, <code>&lt;p/&gt;</code>, etc.) has a CSS property called <code>position</code>.  By default, the <code>position</code> for these block elements is set to <code>static</code>.  Static block elements appear in a stack on the page, from top to bottom.  Here&#8217;s an example:</p>
<pre>&lt;div&gt;Div One&lt;/div&gt;
&lt;div&gt;Div Two&lt;/div&gt;
&lt;div&gt;Div Three&lt;/div&gt;</pre>
<div style="background: #f0f0f0; padding: 1em; border: 1px #e0e0e0 solid; margin: 0 0 1.5em 0;">
<div style="background: #8abb66; padding: 0.5em;">Div One</div>
<div style="background: #d88541; padding: 0.5em;">Div Two</div>
<div style="background: #419dd8; padding: 0.5em;">Div Three</div>
</div>
<p>If you change an element&#8217;s position to <code>absolute</code>, however, its placement on the page is very different.  The placement for an absolutely positioned element is relative to the parent of that element.  What does that mean?  Let&#8217;s see what happens if we take the same code from our last example and make our block elements position: absolute.</p>
<pre>&lt;div style=&quot;position: absolute;&quot;&gt;Div One&lt;/div&gt;
&lt;div style=&quot;position: absolute;&quot;&gt;Div Two&lt;/div&gt;
&lt;div style=&quot;position: absolute;&quot;&gt;Div Three&lt;/div&gt;</pre>
<div style="position: relative; background: #f0f0f0; height: 2em; padding: 1em; border: 1px #e0e0e0 solid; margin: 0 0 1.5em 0;">
<div style="position: absolute; background: #8abb66; padding: 0.5em;">Div One</div>
<div style="position: absolute; background: #d88541; padding: 0.5em;">Div Two</div>
<div style="position: absolute; background: #419dd8; padding: 0.5em;">Div Three</div>
</div>
<p>The outcome is very different!  You can&#8217;t tell, but the first and second <code>&lt;div/&gt;</code> tags are actually hiding behind the third <code>&lt;div/&gt;</code> tag.  Whenever you set an element&#8217;s position to absolute, it is automatically shown at the top-left corner of the parent element <small>(* see notes about relativity below)</small>.  This isn&#8217;t very useful now, but we can apply this technique to create a variety of simple and effective layout styles.</p>
<h2>Positioning</h2>
<p>Our last example wasn&#8217;t very practical simply because all of our <code>&lt;div/&gt;</code> tags were stacked on top of each other.  Using the <code>top</code>, <code>bottom</code>, <code>left</code>, and <code>right</code> properties, we can position absolute elements anywhere we&#8217;d like.  Let&#8217;s try it out.</p>
<pre>&lt;div style=&quot;position: absolute; top: 10px; left: 10px;&quot;&gt;Div One&lt;/div&gt;
&lt;div style=&quot;position: absolute; top: 10px; right: 10px;&quot;&gt;Div Two&lt;/div&gt;
&lt;div style=&quot;position: absolute; bottom: 1em; left: 50%;&quot;&gt;Div Three&lt;/div&gt;</pre>
<div style="position: relative; background: #f0f0f0; height: 4em; padding: 1em; border: 1px #e0e0e0 solid; margin: 0 0 1.5em 0;">
<div style="position: absolute; top: 10px; left: 10px; background: #8abb66; padding: 0.5em;">Div One</div>
<div style="position: absolute; top: 10px; right: 10px; background: #d88541; padding: 0.5em;">Div Two</div>
<div style="position: absolute; bottom: 1em; left: 50%; background: #419dd8; padding: 0.5em;">Div Three</div>
</div>
<p>Now that&#8217;s a little more practical.  The first and second <code>&lt;div/&gt;</code> tags are positioned using pixels from the top, left, and right sides of their parent element (the gray box).  I positioned the third <code>&lt;div/&gt;</code> tag a little differently just to demonstrate how you can use all the different measurement units that CSS has to offer in order to position absolute elements (<abbr title="pixel">px</abbr>, <abbr title="point">pt</abbr>, em, and <abbr title="percent">%</abbr>).</p>
<h2>Relativity</h2>
<p><strong>The most difficult and confusing aspect of absolutely positioned elements is figuring out relative positioning.</strong>  Unless you specify otherwise, your absolute <code>&lt;div/&gt;</code> tags will be positioned relative to your entire HTML document (i.e. the very top left corner of your browser window).  Basically, when your browser is trying to render an absolutely positioned element, it traces upward through your HTML hierarchy until it finds a parent element that uses relative positioning (<code>position: relative</code>).  If you haven&#8217;t set any elements to <code>position: relative</code>, then the <code>&lt;body&gt;</code> tag is used by default.  Always set the outer element to <code>position: relative</code>:</p>
<pre>&lt;div style=&quot;<strong>position: relative;</strong>&quot;&gt;
	&lt;div style=&quot;position: absolute; top: 1em; right: 1em;&quot;&gt;Contact Us / Register / Log Out&lt;/div&gt;
&lt;/div&gt;</pre>
<div style="position: relative; background: #f0f0f0; height: 4em; padding: 1em; border: 1px #e0e0e0 solid; margin: 0 0 1.5em 0;">
<div style="position: absolute; top: 1em; right: 1em; background: #419dd8; padding: 0.5em;">Contact Us / Register / Log Out</div>
</div>
<h2>Relative Parent Height</h2>
<p>If you place an absolutely positioned element on a page, it does not have a layout height associated with it.  That means that even though your absolute DIV is 150 pixels tall, it will <em>not</em> bump the rest of your page down by 150 pixels.  Here&#8217;s an example:</p>
<pre>&lt;div style=&quot;position: relative;&quot;&gt;
	&lt;div style=&quot;position: absolute; height: 2em;&quot;&gt;Div One&lt;/div&gt;
&lt;/div&gt;</pre>
<div style="position: relative; background: #f0f0f0; padding: 1em; border: 1px #e0e0e0 solid; margin: 0 0 2.5em 0;">
<div style="position: absolute; background: #8abb66; padding: 0.5em; height: 2em;">Div One</div>
</div>
<p>The easiest way to avoid this is to set the <em>parent element&#8217;s</em> height to a fixed value.  This should clear up any layout height issues because you&#8217;ll always have space for your absolute elements.  For instance:</p>
<pre>&lt;div style=&quot;position: relative; <strong>height: 3em;</strong>&quot;&gt;
	&lt;div style=&quot;position: absolute; height: 2em;&quot;&gt;Div One&lt;/div&gt;
&lt;/div&gt;</pre>
<div style="position: relative; background: #f0f0f0; padding: 1em; height: 3em; border: 1px #e0e0e0 solid; margin: 0 0 2.5em 0;">
<div style="position: absolute; background: #8abb66; padding: 0.5em; height: 2em;">Div One</div>
</div>
<h2>Absolute vs. Floating</h2>
<p>Absolute positioning shouldn&#8217;t be used in every case.  Often times, I will use it to build out a header on a page where there is a logo, search, some utility links, etc.  These types of controls are pretty consistent and don&#8217;t change in size, and absolute positioning comes in quite handy.  There are, however, some disadvantages to using absolute positioning.  Most importantly, absolutely positioned elements don&#8217;t appears as part of the normal layout flow in your document.  They have a fixed position, which often confines them to a fixed width or height.  If you can&#8217;t predict the size or consistency of the content in a particular page element (for instance, a <em>page content</em> area where article text appears), then absolute positioning is probably not the best option.</p>
<p>As an alternative, you can use CSS floating to create very fluid and flexible layouts without absolute positioning.  See my previous article about <a href="http://www.kyleschaeffer.com/best-practices/all-about-tableless-column-design/">tableless column design</a> to learn more about floating elements in your design.</p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/best-practices/css-absolute-positioning/feed/</wfw:commentRss>
		<slash:comments>7</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>Create a DHTML Tab Strip</title>
		<link>http://kyleschaeffer.com/tutorials/create-a-dhtml-tab-strip/</link>
		<comments>http://kyleschaeffer.com/tutorials/create-a-dhtml-tab-strip/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 18:18:23 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Web Controls]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DHTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Tabs]]></category>
		<category><![CDATA[XHTML]]></category>

		<guid isPermaLink="false">http://www.kyleschaeffer.com/?p=107</guid>
		<description><![CDATA[Tab strips are commonplace throughout the web, and they&#8217;re utilized in a wide variety of ways, such as in site navigation or form wizards. Organizing links in a tabbed format can add quite a bit of style and functionality to &#8230; <a href="http://kyleschaeffer.com/tutorials/create-a-dhtml-tab-strip/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Tab strips are commonplace throughout the web, and they&#8217;re utilized in a wide variety of ways, such as in site navigation or form wizards.  Organizing links in a tabbed format can add quite a bit of style and functionality to your site, as many visitors are already familiar and comfortable with using tabs on other websites and even on other platforms such as their operating system.  This tutorial shows you how to create a simple DHTML tab strip using HTML, CSS, and a small bit of JavaScript.<span id="more-107"></span></p>
<p>When I use the term &#8220;DHTML,&#8221; I am referring to &#8220;Dynamic HTML.&#8221;  This is an endearing term that many web designers use to describe the fusion of HTML with other web technologies, such as JavaScript and CSS.  By using various technologies in tandem, we can create dynamic controls that allow website visitors to interact with content directly on the page without the need to refresh the site with every subsequent click.</p>
<h2>The HTML</h2>
<p>As you will soon see, the tab strip is a prime example of a DHTML control.  Before we delve into every aspect of the tab strip, let&#8217;s first start with the HTML:</p>
<pre>&lt;div class=&quot;tabStrip&quot;&gt;
	&lt;ul&gt;
		&lt;li&gt;&lt;a href=&quot;javascript:openTab(1);&quot; class=&quot;tabLinkActive&quot; id=&quot;tabLink1&quot;&gt;TabOne&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;javascript:openTab(2);&quot; class=&quot;tabLink&quot; id=&quot;tabLink2&quot;&gt;TabTwo&lt;/a&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href=&quot;javascript:openTab(3);&quot; class=&quot;tabLink&quot; id=&quot;tabLink3&quot;&gt;TabThree&lt;/a&gt;&lt;/li&gt;
	&lt;/ul&gt;
&lt;/div&gt;
&lt;div class=&quot;tabContentActive&quot; id=&quot;tabContent1&quot;&gt;
	This is sample tab content (1).
&lt;/div&gt;
&lt;div class=&quot;tabContent&quot; id=&quot;tabContent2&quot;&gt;
	This is sample tab content (2).
&lt;/div&gt;
&lt;div class=&quot;tabContent&quot; id=&quot;tabContent3&quot;&gt;
	This is sample tab content (3).
&lt;/div&gt;</pre>
<p>The HTML is relatively simple. We are using an unordered list (<code>&lt;ul/&gt;</code>) for our tabs, and we are using <code>&lt;div/&gt;</code> tags for our tab content. As you can see, I am giving a unique <code>id</code> attribute to each tab link and to each tab content <code>&lt;div/&gt;</code>.  This is important, as we&#8217;ll need unique <code>id</code>&#8216;s in order to access these elements with JavaScript.</p>
<h2>The JavaScript</h2>
<p>We are using only one small JavaScript function for the tab control.  Here is the code:</p>
<pre>&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;
	var activeTab = 1;
	function openTab(tabId) {
		// reset old tab and content
		document.getElementById(&quot;tabLink&quot;+activeTab).className = &quot;tabLink&quot;;
		document.getElementById(&quot;tabContent&quot;+activeTab).className = &quot;tabContent&quot;;
		// set new tab and content
		document.getElementById(&quot;tabLink&quot;+tabId).className = &quot;tabLinkActive&quot;;
		document.getElementById(&quot;tabContent&quot;+tabId).className = &quot;tabContentActive&quot;;
		activeTab = tabId;
	}
&lt;/script&gt;</pre>
<h2>The CSS:</h2>
<p>This CSS is a very basic example of what you can do to style your tabs. You can add colors, gradients, and background images to give the control even more design flare.</p>
<pre>.tabStrip ul {
	margin: 0;
	padding: 0;
	list-style-type: none;
}
.tabStrip li {
	margin: 0 2px 0 0;
	list-style-type: none;
	float: left;
}
.tabLink {
	display: block;
	text-decoration: none;
	padding: 5px;
	background: #e8e8e8;
	border: #dadada solid;
	border-width: 1px 1px 0 1px;
	color: #8a8a8a;
}
.tabLinkActive {
	display: block;
	text-decoration: none;
	padding: 5px;
	background: #e0e0e0;
	border: #c0c0c0 solid;
	border-width: 1px 1px 0 1px;
	color: #0066ff;
}
.tabContent {
	display: none;
}
.tabContentActive {
	display: block;
	clear: both;
	background: #f0f0f0;
	border: 1px #dedede solid;
	padding: 10px;
}</pre>
<h2>The Result:</h2>
<p>In true DHTML fashion, we have combined HTML, JavaScript, and CSS to create a fully dynamic user control that can appear anywhere on the web. I have taken the fundamentals learned in this tutorial and have created a more visually appealing example of this code.  Click on the image below to see the demo.</p>
<p><a href="http://www.kyleschaeffer.com/tabstrip/"><img src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2008/11/tabs.jpg" alt="Tab Strip Demo" /></a></p>
<p>Note that the demo also utilizes Karate Corners to create rounded edges on the tabs.  <a href="http://www.kyleschaeffer.com/tutorials/karate-corners-easy-rounded-corners-xhtml-no-script/">Learn more about Karate corners here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/tutorials/create-a-dhtml-tab-strip/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

