<?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; CSS</title>
	<atom:link href="http://kyleschaeffer.com/tag/css/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>SharePoint 2010 Pop-Up Dialogs</title>
		<link>http://kyleschaeffer.com/sharepoint/sharepoint-2010-pop-up-dialogs/</link>
		<comments>http://kyleschaeffer.com/sharepoint/sharepoint-2010-pop-up-dialogs/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 17:58:30 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://kyleschaeffer.com/?p=671</guid>
		<description><![CDATA[SharePoint 2010 makes it incredibly easy to add dialog content to your website. Built-in functionality allows you to retrieve content from anywhere within your site and display it in a modal dialog that appears over the page. This is pretty &#8230; <a href="http://kyleschaeffer.com/sharepoint/sharepoint-2010-pop-up-dialogs/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>SharePoint 2010 makes it incredibly easy to add dialog content to your website. Built-in functionality allows you to retrieve content from anywhere within your site and display it in a modal dialog that appears over the page.  This is pretty standard stuff when it comes to modern web technology, but the ease of use is what makes SharePoint dialogs so amazing.  In this article, we&#8217;ll explore the dialog functionality that comes with the SharePoint 2010 platform, and we&#8217;ll discover new ways to customize that content to create a uniquely fresh appearance for your SharePoint portal.<span id="more-671"></span></p>
<h2>Dialogs in SharePoint 2010</h2>
<p>Even if you have chosen not to acknowledge dialogs in SharePoint 2010 just yet, they&#8217;re already being used throughout the SharePoint platform for things like pages, lists, and libraries.  Every time you create a new page, for instance, you&#8217;ll see a dialog that appears on the page.  It most likely looks something like this:<br />
<img class="alignnone size-full wp-image-672" title="SharePoint 2010 Dialog" src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2010/11/sp2010-dialog.png" alt="SharePoint 2010 Dialog" width="394" height="207" /></p>
<p>You&#8217;ll see similar dialogs when you create and edit list items, as well as within any document libraries that you have created throughout your site collection.  These pop-up forms and views are an integral part of the SharePoint 2010 platform.</p>
<h2>How it Works</h2>
<p>SharePoint 2010 dialogs are fairly simple.  They are basically a JavaScript pop-up dialog that include an <code>iframe</code> to request content from elsewhere on your site.  This content can be anything inside SharePoint, even publishing pages or custom application pages that you&#8217;ve created yourself.</p>
<p>If you&#8217;ve ever created your own master page in SharePoint 2010, you may have been confused when you were prompted with two options when trying to apply your new master page to the site.  SharePoint 2010 segregates your master page delegation between <strong>site</strong> master page and <strong>system</strong> master page.  Basically, your <em>site</em> master page will be applied to pages, lists, and libraries, where the <em>system</em> master page is applied to everything else (settings, permissions, administration, and&#8230;dialogs).  When you call a pop-up dialog in SharePoint, the content is requested and is displayed using <strong>system</strong> master page.  If you want to start customizing the way your dialogs appear in SharePoint 2010, the first step is to format your custom master page to also work as a system master page.</p>
<h2>System Master Pages</h2>
<p>The most important thing you&#8217;ll want to do in order to optimize your master page for dialog use is to designate which elements of the page will be hidden inside a dialog view.  If you open Microsoft&#8217;s <strong>v4.master</strong> file, you may notice that <code>class="s4-notdlg"</code> appears in numerous places throughout the file.  The <strong>s4-notdlg</strong> class name should be applied to anything you want to <em>hide</em> in the dialog view.  This means headers, footers, navigation, sidebars, etc.  Basically, you&#8217;ll want to add this CSS class to everything except for the main content area of your design.  When dialogs are displayed, anything with the <strong>s4-notdlg</strong> CSS class is automatically trimmed out.</p>
<h3>Dealing with Style</h3>
<p>Your design most likely has a fixed width, or at the very least, a minimum width at which it can display.  Dialogs are very small in size, so the width and size formatting that you&#8217;ve established for your design won&#8217;t necessarily work nicely within the dialog view.  Fortunately, any time your master page is used to display dialog content, the <code>html</code> element gets a special CSS class name called <strong>ms-dialog</strong>.  You can use this to override any styles that you&#8217;ve set for your design, making it appear correctly both in normal and in dialog views.  For example, you might have a <code>div</code> element in your design with an ID of <code>wrapper</code>.  In an attached CSS file, you can style this element as it appears both in normal and dialog views:</p>
<pre>#wrapper {
  width: 960px;
  margin: auto;
}
<strong>html.ms-dialog</strong> #wrapper {
  width: 100%;
}</pre>
<p>In the above example, the <code>wrapper</code> element will switch to fluid width when displayed inside a SharePoint 2010 dialog.  You may have to utilize this technique with things like columns, background colors, and other design elements as they appear inside the dialog.</p>
<h2>Harness the Power</h2>
<p>Now that your master page is optimized for dialog use, it&#8217;s time to start pulling some content from your SharePoint site.  Creating a pop-up link is extremely easy.  On any page or within a content editor web part, create a link to request a dialog page:</p>
<pre>&lt;a href="<strong>javascript:OpenPopUpPage('/path/to/content.aspx');</strong>"&gt;Show Me the Pop-Up!&lt;/a&gt;</pre>
<p>You can use the <strong>OpenPopUpPage</strong> function to view any content in dialog mode.  There is also a more flexible function called <strong>OpenWebPage</strong> that allows you to specify things like dialog width and height.  Using these function in conjunction with a custom system master page, the limits to what you can display within a dialog in SharePoint are really limitless.</p>
<h2>Progressive Enhancement</h2>
<p>I&#8217;m all about accessibility, and I really don&#8217;t like it when someone asks me to put <strong>javascript:</strong> inside a link element.  Users without JavaScript won&#8217;t be able to follow the link, and perhaps more importantly, search engines like Google or Bing won&#8217;t be able to track the content associations within your site.  This can be a huge problem, and as such, I wouldn&#8217;t recommend using the above method for dialogs in your SharePoint site.</p>
<p>A better approach involves an exercise in progressive enhancement.  Progressive enhancement demands that you create a solution that functions for users with the least functionality enabled within their web browsers.  This means creating simple HTML links that point to real web page content.  By creating simple links, you can guarantee that everyone (including search engines) can decipher and utilize the links in your site.  For other users, such as JavaScript-enabled users, you can <em>enhance</em> their experience with things like pop-up dialogs to display content more quickly.</p>
<p>This is easy enough to do in SharePoint 2010, simply because our custom master page is formatted to display content in both normal and dialog views already.  We can easily direct users to the normal view of the content, and override that functionality for script-enabled users of our site.</p>
<h2>SharePop</h2>
<p>In true progressive enhancement fashion, I have created a simple jQuery function that will turn any normal link in your SharePoint site into a pop-up dialog link, simply by associating a CSS class with that anchor tag.  Add this functionality to your own SharePoint 2010 site:</p>
<ol>
<li>Ensure that the <a href="http://jquery.com/">jQuery script library</a> is attached to the master page or page layout on which you will utilize my script</li>
<li>Add the following jQuery function to an attached JavaScript file:
<pre>(function($){
  $.fn.sharePop = function(){
    if(typeof OpenPopUpPage == 'function'){
      return this.each(function(i){
        if($(this).attr('href') != null){
          $(this).click(function(e){
            e.preventDefault();
            OpenPopUpPage($(this).attr('href'));
          });
        }
      });
    }
    else{
      return false;
    }
  };
})(jQuery);</pre>
</li>
<li>Add a unique CSS class name to the links you wish to display in dialog view:
<pre>&lt;a href="/path/to/content.aspx" <strong>class="dialog-pop"</strong>&gt;View Content&lt;/a&gt;</pre>
</li>
<li>Run the script (add this to an attached JavaScript file):
<pre>$(document).ready(function(){
	$('<strong>.dialog-pop</strong>').sharePop();
});</pre>
</li>
</ol>
<p>My script will override the default functionality of these links, and force them to display inside the SharePoint 2010 dialog view instead.  Accessibility prevails, as users and search engines which do not utilize JavaScript are still able to view the content (albeit in the normal view of the design).</p>
<h2>Dialog Style</h2>
<p>The last thing you&#8217;ll want to consider when using SharePoint dialogs is the <em>style</em> of the dialogs, themselves.  The dialog HTML gives you numerous CSS classes that allow you to completely customize the appearance of the dialog window, and even the appearance of the shaded area behind the dialog.  The following image shows the HTML of the SharePoint dialog, and I&#8217;ve also highlighted some important CSS classes you&#8217;ll use to change the appearance of the windows.<br />
<img src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2010/11/sp2010-dialog-html.png" alt="SharePoint 2010 Dialog HTML" title="SharePoint 2010 Dialog HTML" width="540" height="202" class="alignnone size-full wp-image-675" /></p>
<p>Using these classes, you can create a unique appearance of the dialogs in short order.  Here is an example of a &#8220;dark&#8221; theme dialog:</p>
<pre>.ms-dlgOverlay {
  background-color: #333;
}
.ms-dlgContent {
  border: 0;
}
.ms-dlgBorder {
  border: 1px solid #333;
}
.ms-dlgTitle {
  background-color: #333;
}
.ms-dlgTitleText {
  display: block;
  font-weight: bold;
  font-size: 13px;
  padding: 7px;
}</pre>
<p>After adding the CSS to an attached CSS style sheet, we get a completely custom dialog appearance, along with custom content that appears within the dialog box, itself.<br />
<img src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2010/11/sp2010-dialog-custom.png" alt="Styled Dialog with Custom Content" title="Styled Dialog with Custom Content" width="520" height="183" class="alignnone size-full wp-image-676" /></p>
<p>There&#8217;s a lot of elements coming together in SharePoint 2010 dialogs, and it can take some practice and determination to get all the pieces fitting together quite right.  If you can do it once, you&#8217;ll find that these custom dialogs are a simple, fast, and amazing tool to add to any SharePoint 2010 design.</p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/sharepoint/sharepoint-2010-pop-up-dialogs/feed/</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<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>Designing Body Type</title>
		<link>http://kyleschaeffer.com/best-practices/designing-body-type/</link>
		<comments>http://kyleschaeffer.com/best-practices/designing-body-type/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 21:26:55 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://www.kyleschaeffer.com/?p=612</guid>
		<description><![CDATA[Header text gets all the love, doesn&#8217;t it? From Photoshop to the browser window, the focus seems to be on design elements like logos, navigation, and of course, header type. It&#8217;s great fun to use tools like Typekit to make &#8230; <a href="http://kyleschaeffer.com/best-practices/designing-body-type/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Header text gets all the love, doesn&#8217;t it? From Photoshop to the browser window, the focus seems to be on design elements like logos, navigation, and of course, header type. It&#8217;s great fun to use tools like <a href="http://typekit.com">Typekit</a> to make your header text something a little less than ordinary. It defines your site, gives you a unique look and feel, and gives readers that oh-so-scannable sensation they know and love. When you really think about it, however, readers aren&#8217;t there for the header text. The headers serve as an essential tool to quickly find what you&#8217;re looking for, but the real prize here is the body text, isn&#8217;t it? This is where your information is, this is where you write and communicate to readers, and this is an area of design that cannot be neglected. Sadly, it often is.<span id="more-612"></span></p>
<p>Body text is often an after-thought in design. We have all been guilty of this at some point in our careers. When you implement your CSS, you might simply throw a <code>body { font-family: blah, blah blah; }</code> into the CSS, and after that you move on. You&#8217;ve probably figured out the whole base font size <em>thing</em> too, which can help, but there&#8217;s so much more you can do. Let&#8217;s look at a number of things to help your body type become something a bit more visually appealing and readable.</p>
<h2>Text Color</h2>
<p>Hopefully you&#8217;ve already figured this one out, but I dare not exclude it for the sake of accuracy. Probably the single most important thing you can do to your body text is change both the color of the text as well as the background color of the area shown behind the text. Here&#8217;s a few pointers:</p>
<ul>
<li>Readers generally prefer dark text on a light background. There are a few impressive exceptions to this rule, but for the most part, it&#8217;s best to stick with the old &#8220;dark on light&#8221; tried-and-true formula.</li>
<li>While contrast is important, don&#8217;t take it too far. Black text (<code>#000000</code>) on a white background (<code>#ffffff</code>) is perhaps a bit too much contrast. Opting for a slightly lighter shade of text can make it easier on your readers&#8217; eyes. If I&#8217;m working on a white background, I generally choose a font color that is at or in the general vicinity of <code>#666666</code> (don&#8217;t be afraid to add a subtle hue of color too, but keep it dark).</li>
<li>Add some variety by slightly changing the color of elements in your body text like darker <code>&lt;strong&gt;</code> text or lighter <code>&lt;li&gt;</code> items. You don&#8217;t have to stick with a single color for all text in the entire design.</li>
<li>Keep the focus on your article or body text. If you have a sidebar or widgets that appear to the side of your actual body text, try lightening their text color (or reducing contrast with a different background color) to make sure that users focus on the real content of the page.</li>
</ul>
<h2>Font Size</h2>
<p>Another obvious and quite important element of your body text style is the font size. There are <a href="http://www.kyleschaeffer.com/best-practices/css-font-size-em-vs-px-vs-pt-vs/">a number of different ways</a> to establish a default font size for your text. While the method of setting your font sizes is a matter of debate, there are a few best practices you should be aware of.</p>
<ul>
<li>It&#8217;s easiest on your users to set the <code>body</code> font size at <code>62.5%</code>, and use <code>ems</code> to size your fonts from there (<code>.wrapper { font-size: 1.3em; }</code> would set the font size to 13 pixels in height).</li>
<li>Choose a base font size of at least 12 pixels in height. There are exceptions to every rule, but you&#8217;ll find that users are frustrated by tiny font sizes, and are apt to leave a site even before using the handy browser zoom feature.</li>
<li>Deviate from the base font size only where it makes sense in the overall theme of the design. Consistency is key. Set default CSS styles for things like the <code>&lt;small&gt;</code> tag and headers.</li>
</ul>
<h2>Font Family</h2>
<p>Fonts are a bit tricky in web design, basically because you&#8217;re forced to choose one of about ten fonts that are used on every other website in the world. <a href="http://typekit.com">Typekit</a> is great for header text, but you&#8217;re better off using regular web-friendly fonts for your body text. Here&#8217;s a few pointers:</p>
<ul>
<li><strong>Serif vs. Sans-Serif:</strong> First choose the font style you&#8217;ll be working with. Choose something that fits with your design&#8217;s overall theme or concept. Serif fonts like Times and Georgia give your site a vintage and book-like feel. They are flowing, artistic, and regal in theme. Sans-serif fonts like Arial or Helvetica can be used to portray a clean, professional, and strong atmosphere in your design.</li>
<li>Choose a <a href="http://www.ampsoft.net/webdesign-l/WindowsMacFonts.html" target="_blank">common font</a> for your body text that is available on both Mac and PC platforms. There are some great fonts on the Mac, but you&#8217;ll want to design your site so that it looks good no matter what device is accessing it.</li>
<li>It&#8217;s completely acceptable to add a &#8220;nice to have&#8221; font into your design, such as Helvetica or Myriad Pro. These fonts can gracefully degrade to Arial without jarring the layout of your page too much.</li>
<li>Georgia and Times are not the only serif fonts available! Try experimenting with fonts like Book Antiqua or Platino Linotype, which have a more book-like and artistic feel.</li>
<li>Courier New is a great fixed-width font best used for displaying CSS, HTML, or some kind of code to your readers.</li>
<li>Don&#8217;t forget other elements in your design! By default, text boxes, buttons, and select menus will not use the body font family and/or size, so make sure to set a consistent font on all elements in your design.</li>
<li>Don&#8217;t use Comic Sans.</li>
</ul>
<h2>Margin, Spacing, and Line Height</h2>
<p>This is probably the most overlooked element of body type design. After you&#8217;ve developed the <strong>character</strong> design of your body type, take a step back and examine the <strong>paragraph</strong> style.</p>
<ul>
<li>Unless you specify otherwise, the lines of text in your design are drawn very close together, and it can be difficult for readers to follow as they read down the page. Add a bit of CSS such as <code>p { line-height: 1.5em; }</code> to make this text easier on the eyes.</li>
<li>Likewise, paragraphs of text have default margins applied to them that may make them appear too close together or too far away from the headers that appear above them. Try adding some CSS such as <code>p { margin: 0 0 1.5em 0; }</code> to standardize the spacing around paragraphs.</li>
<li>Paragraph text is not the only thing you&#8217;ll see in a page. Don&#8217;t forget to style other HTML elements like lists (<code>&lt;ul&gt;</code> or <code>&lt;ol&gt;</code>), the horizontal rule (<code>&lt;hr /&gt;</code>), and block quotes or call-out boxes.</li>
</ul>
<h2>Be Creative</h2>
<p>Following these rules isn&#8217;t a guaranteed way to make your body type look amazing, and breaking any or all of these rules certainly doesn&#8217;t guarantee that your design will be ugly and fail. In the end, it&#8217;s all about being creative and paying attention to all the tiny details that go into making a website look amazing. The difference between a good design and a bad one can be very subtle. Create something fun, stick to a theme, and take note of every visual detail that appears on the page, body type included.</p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/best-practices/designing-body-type/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>Create a Lightbox with jQuery and CSS</title>
		<link>http://kyleschaeffer.com/tutorials/lightbox-jquery-css/</link>
		<comments>http://kyleschaeffer.com/tutorials/lightbox-jquery-css/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 21:37:05 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[DHTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.kyleschaeffer.com/?p=488</guid>
		<description><![CDATA[The &#8220;lightbox&#8221; is a unique and useful design tool when used properly. It allows designers to present information that is totally independent from the site theme, and it is especially useful when displaying information that is loaded via AJAX requests &#8230; <a href="http://kyleschaeffer.com/tutorials/lightbox-jquery-css/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The &#8220;lightbox&#8221; is a unique and useful design tool when used properly. It allows designers to present information that is totally independent from the site theme, and it is especially useful when displaying information that is loaded via AJAX requests (often negating the need for additional post-backs on your pages). There are countless ways to implement lightbox functionality into your site, and almost every option I&#8217;ve ever seen is weighed down by extraneous functionality or useless transition animations. It&#8217;s quite easy to create your own lightboxes with minimal effort. This tutorial can serve as a quick and easy template to get you started.<span id="more-488"></span></p>
<h2>The CSS Style</h2>
<p>There are <em>two</em> elements you&#8217;ll have to implement into your design in order to create a lightbox — CSS and Javascript. We&#8217;ll take care of the CSS style first, as it&#8217;s the most simple to implement. On your page or in an attached style sheet, add the following CSS styles:</p>
<pre>#lightbox {
	position: absolute;
	top: 0;
	left: 50%;
	width: 500px;
	margin-left: -250px;
	background: #fff;
	z-index: 1001;
	display: none;
}
#lightbox-shadow {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: #000;
	filter: alpha(opacity=75);
	-moz-opacity: 0.75;
	-khtml-opacity: 0.75;
	opacity: 0.75;
	z-index: 1000;
	display: none;
}</pre>
<p><strong>What we just did:</strong> we established two styles. One style is for the lightbox that actually appears on the page (<code>#lightbox</code>). The second style is for lightbox background (<code>#lightbox-shadow</code>). We have made this background dark and semi-transparent in order to dim the site&#8217;s content as it appears behind the lightbox.</p>
<h2>The jQuery Script</h2>
<p>The real work is done via our simple jQuery script. We have two JavaScript functions that will handle displaying and hiding our lightbox. First, make sure you have attached the jQuery library to your page:</p>
<pre>&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;&gt;&lt;/script&gt;</pre>
<p>Now, in an attached <code>.js</code> file, add the following script code.</p>
<pre>/****************************************
	Barebones Lightbox Template
	by Kyle Schaeffer
	kyleschaeffer.com
	* requires jQuery
****************************************/

// display the lightbox
function lightbox(insertContent, ajaxContentUrl){

	// add lightbox/shadow &lt;div/&gt;'s if not previously added
	if($('#lightbox').size() == 0){
		var theLightbox = $('&lt;div id=&quot;lightbox&quot;/&gt;');
		var theShadow = $('&lt;div id=&quot;lightbox-shadow&quot;/&gt;');
		$(theShadow).click(function(e){
			closeLightbox();
		});
		$('body').append(theShadow);
		$('body').append(theLightbox);
	}

	// remove any previously added content
	$('#lightbox').empty();

	// insert HTML content
	if(insertContent != null){
		$('#lightbox').append(insertContent);
	}

	// insert AJAX content
	if(ajaxContentUrl != null){
		// temporarily add a &quot;Loading...&quot; message in the lightbox
		$('#lightbox').append('&lt;p class=&quot;loading&quot;&gt;Loading...&lt;/p&gt;');

		// request AJAX content
		$.ajax({
			type: 'GET',
			url: ajaxContentUrl,
			success:function(data){
				// remove &quot;Loading...&quot; message and append AJAX content
				$('#lightbox').empty();
				$('#lightbox').append(data);
			},
			error:function(){
				alert('AJAX Failure!');
			}
		});
	}

	// move the lightbox to the current window top + 100px
	$('#lightbox').css('top', $(window).scrollTop() + 100 + 'px');

	// display the lightbox
	$('#lightbox').show();
	$('#lightbox-shadow').show();

}

// close the lightbox
function closeLightbox(){

	// hide lightbox and shadow &lt;div/&gt;'s
	$('#lightbox').hide();
	$('#lightbox-shadow').hide();

	// remove contents of lightbox in case a video or other content is actively playing
	$('#lightbox').empty();
}</pre>
<link rel="stylesheet" type="text/css" href="http://kyleschaeffer.com/wordpress/wp-content/uploads/2010/03/lightbox.css" />
<style type="text/css">#lightbox-shadow { position: fixed; } #lightbox { font-size: 2em; padding: 20px; margin-left: -270px; }</style>
<p><script type="text/javascript" src="http://kyleschaeffer.com/wordpress/wp-content/uploads/2010/03/lightbox.js"></script><br />
<h2>Ready for Lightboxing</h2>
<p>Once you have the CSS and script into place, you can call your new <code>lightbox();</code> function from anywhere within your design. It&#8217;s as easy as calling the lightbox from an <code>anchor</code> tag:</p>
<pre>&lt;a href=&quot;javascript:lightbox('Hello!');&quot;&gt;Show me the lightbox&lt;/a&gt;</pre>
<p>Remember, clicking anywhere on the &#8220;shadow&#8221; <code>&lt;div/&gt;</code> will hide the lightbox &mdash; you could easily add a &#8220;close&#8221; button to your lightbox by connecting it to the <code>closeLightbox();</code> JavaScript function.</p>
<p>Similarly, you can insert HTML (or even a jQuery DOM object) into the lightbox. Like so:</p>
<pre>&lt;a href=&quot;javascript:lightbox('&lt;p&gt;&lt;strong&gt;Rich&lt;/strong&gt; content works too!&lt;/p&gt;');&quot;&gt;Show me the lightbox&lt;/a&gt;</pre>
<p>Finally, you can even use this simple lightbox function to insert AJAX content. Please keep in mind that my JavaScript function simply inserts the entire result into the <code>#lightbox</code> element &mdash; if you&#8217;re trying to request a website or HTML page, you&#8217;ll probably have to remove the <code>&lt;html/&gt;</code> and <code>&lt;body/&gt;</code> tags before inserting content into your lightbox window, else the lightbox would simply disappear. An AJAX lightbox request looks a little like this:</p>
<pre>&lt;a href=&quot;javascript:lightbox(null, 'http://foo.com/readme.txt');&quot;&gt;Show me the lightbox&lt;/a&gt;</pre>
<h2>The Demo</h2>
<ul>
<li><strong>Try it out:</strong> <a href="javascript:lightbox('How elegantly simple! This is a barebones lightbox if I ever saw one. Click on the dark shaded background to close the lightbox.');">Show me the lightbox</a></li>
<li><strong>Let&#8217;s load some AJAX content:</strong> <a href="javascript:lightbox(null, 'http://kyleschaeffer.com/wordpress/wp-content/uploads/2010/03/lightbox.css');">Load the CSS file for this tutorial into a lightbox</a></li>
</ul>
<p>If you&#8217;re on a fast connection, you may not notice, but the AJAX link actually reads &#8220;Loading&#8230;&#8221; in the lightbox a split-second before the content actually appears.  This can be useful to give users feedback while the AJAX request is processing. Please note that I&#8217;ve added a bit of styling to my demo (namely padding on the lightbox to make it appear less cluttered).</p>
<h2>Make it Shine</h2>
<p>You&#8217;ll probably want to modify the CSS and other elements of this lightbox in order to suit your site&#8217;s design and style. If you&#8217;re working with a lot of AJAX content, you may want to even replace the temporary <code>loading</code> element with an animated spinner image, or something of the like.</p>
<p>To help you get started, you can download the CSS and JavaScript referenced in this tutorial here:</p>
<ul>
<li><a href="http://kyleschaeffer.com/wordpress/wp-content/uploads/2010/03/lightbox.css">lightbox.css</a></li>
<li><a href="http://kyleschaeffer.com/wordpress/wp-content/uploads/2010/03/lightbox.js">lightbox.js</a></li>
</ul>
<p>Good luck, and happy styling!</p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/tutorials/lightbox-jquery-css/feed/</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>9 Amazing Things You Can Do in Firefox 3.6</title>
		<link>http://kyleschaeffer.com/best-practices/9-amazing-things-firefox-3-6/</link>
		<comments>http://kyleschaeffer.com/best-practices/9-amazing-things-firefox-3-6/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 16:43:32 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Best Practices]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Browsers]]></category>

		<guid isPermaLink="false">http://www.kyleschaeffer.com/?p=480</guid>
		<description><![CDATA[The latest update to Mozilla&#8217;s wonderful web browser, Firefox 3.6, includes support for some fantastic CSS version 3 recommendations that you may or may not be aware of. Obviously, these tricks won&#8217;t work in Internet Explorer just yet, but look &#8230; <a href="http://kyleschaeffer.com/best-practices/9-amazing-things-firefox-3-6/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>The latest update to Mozilla&#8217;s wonderful web browser, Firefox 3.6, includes support for some fantastic <a href="http://www.w3.org/Style/CSS/current-work#CSS3">CSS version 3 recommendations</a> that you may or may not be aware of. Obviously, these tricks won&#8217;t work in Internet Explorer just yet, but look for widespread support coming in the (hopefully) very near future.<span id="more-480"></span></p>
<p>Most of the new features revolve around background image and color management. This has been a definite pain point for designers in the past, as we&#8217;ve had to create extraneous <code>&lt;div/&gt;</code> tags and other silly markup hacks to implement our favorite visual elements. Fear not, for all browsers will soon support these great features! If you&#8217;ve already installed Firefox 3.6, you should plainly see all the great features in my examples below. If you haven&#8217;t installed the latest update, head on over to <a href="http://www.mozilla.com/firefox/">Mozilla&#8217;s website</a> now to download the latest version.</p>
<style type="text/css">
.box {
	margin: 0 0 20px 0;
	padding: 20px;
	border: 1px #ddd solid;
	-webkit-border-radius: 15px;
	-moz-border-radius: 15px;
	-o-border-radius: 15px;
	border-radius: 15px;
	text-align: justify;
}
.shiny-box {
	background: -moz-linear-gradient(top, #fff, #e9e9e9);
}
.slide {
	background: -moz-linear-gradient(top -45deg, violet, blue);
	color: #fff;
}
.rainbow {
	background: -moz-linear-gradient(left 20deg, violet, red, orange, yellow, green, teal, blue, purple);
	color: white;
}
.alpha {
	background: -moz-linear-gradient(left, rgba(255,255,255,1), rgba(255,255,255,0)), #4aceff url(http://thepeev.com/wp-content/themes/thepeev/images/plant.png) bottom no-repeat;
}
.radial {
	background: -moz-radial-gradient(top left, white 20%, orange);
}
.slasher {
	background: -moz-repeating-linear-gradient(left -45deg, #fff, #f5f5f5 1px, #fff 5px, #fff 1px);
}
.burst {
	background: -moz-repeating-radial-gradient(-5px -5px, circle, #bfeeff, #bfeeff 15px, #fff 15px, #fff 30px, #bfeeff 30px, #bfeeff 40px);
	border: 5px #bfeeff solid;
}
.layers {
	background: url(http://demos.hacks.mozilla.org/openweb/resources/images/logos/firefox-48.png), -moz-linear-gradient(left, rgba(255, 255, 255, 0),  rgba(255, 255, 255, 0.8)), url(http://demos.hacks.mozilla.org/openweb/resources/images/patterns/flowers-pattern.jpg);
	background-repeat: no-repeat, no-repeat, repeat;
	background-position: bottom right, left, right;
	color: #fff;
}
.layers strong {
	color: #fff;
}
.sizer {
	background: #f5f5f5 url(http://demos.hacks.mozilla.org/openweb/resources/images/logos/firefox-48.png) bottom right no-repeat;
	-moz-background-size: 120px;
	-webkit-background-size: 120px;
	-o-background-size: 120px;
}
</style>
<h2>The Linear Gradient</h2>
<p>You can now add linear gradients to your HTML elements with a handy CSS attribute called <code>-moz-linear-gradient</code>. Here are a few examples to get you started.</p>
<h3>A simple example:</h3>
<p class="box shiny-box"><strong>Are you using <a href="http://www.mozilla.com/firefox/">Firefox 3.6</a>? Check out my linear gradient background.</strong> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin tempor odio ac elit faucibus vel rhoncus purus hendrerit. Pellentesque imperdiet fermentum lacinia.</p>
<h3>The CSS:</h3>
<pre>.shiny-box {
	background: -moz-linear-gradient(top, #fff, #e9e9e9);
}</pre>
<h3>Drawing gradients at an angle:</h3>
<p class="box slide"><strong>Gradient backgrounds can be drawn at an angle.</strong> Quisque mollis, dui quis hendrerit accumsan, dui lorem congue nibh, et scelerisque neque tortor ac magna. Quisque faucibus lectus tellus. Cras sodales, nulla in suscipit ultricies, mi neque pulvinar augue, a congue lacus tellus eu lorem. Donec varius posuere ligula, adipiscing adipiscing nibh eleifend eu. Nulla sagittis porttitor placerat. Praesent non pretium nisl. Curabitur tempor ante sed orci commodo placerat. Curabitur faucibus ornare augue. Duis adipiscing libero sed ante venenatis posuere. Etiam sodales felis ac est ultricies volutpat. Pellentesque varius iaculis dui, in interdum turpis porta ac. Ut rutrum consequat lectus sit amet euismod. Proin suscipit metus vitae magna condimentum eget blandit ante blandit. Duis lorem magna, luctus sed rutrum non, dictum a erat. In egestas libero a nisl faucibus lobortis. Duis aliquam erat vitae ipsum placerat quis dignissim elit pretium. Sed dictum interdum feugiat. Praesent feugiat libero a enim vulputate ut viverra tortor ornare. Donec vel diam mi. Morbi porttitor porttitor mattis.</p>
<h3>The CSS:</h3>
<pre>.slide {
	background: -moz-linear-gradient(top -45deg, violet, blue);
	color: #fff;
}</pre>
<h3>Stringing colors together:</h3>
<p class="box rainbow"><strong>Specify multiple colors in your gradients.</strong> In fermentum ipsum eget quam pharetra sagittis. Phasellus mollis, nulla nec sagittis pharetra, magna tortor commodo felis, eget dictum sem ipsum gravida ligula. Aliquam pharetra libero quis ligula sollicitudin condimentum. Sed sed diam nulla. Fusce malesuada gravida felis, id porttitor lacus porttitor sed. Maecenas mollis feugiat ultrices. In ac viverra ligula. Maecenas suscipit tempor nibh ac mattis. Morbi ac metus velit. Morbi enim purus, adipiscing at consectetur eget, blandit id nibh.</p>
<h3>The CSS:</h3>
<pre>.rainbow {
	background: -moz-linear-gradient(left 20deg, violet, red, orange, yellow, green, teal, blue, purple);
	color: white;
}</pre>
<h2>Alpha Gradients</h2>
<p>Alpha gradients allow you to specify an RGBA transparency for background images and colors. This allows you to &#8220;fade&#8221; your background on a gradient, so it gets slightly more opaque as you near the edge of your element. It works a lot like the linear gradients shown above.</p>
<h3>Let&#8217;s try it out:</h3>
<p class="box alpha"><strong>Apply alpha gradients to background colors and images.</strong> Mauris id mauris diam, vel hendrerit tortor. Pellentesque leo erat, ullamcorper et consectetur eget, elementum id ipsum. Vestibulum et diam mi, quis commodo velit. Maecenas bibendum purus id sapien sodales ut dapibus est consectetur. Donec vel elementum quam. Suspendisse quis risus nulla. Cras imperdiet, est sit amet rhoncus tincidunt, elit turpis consectetur enim, sit amet gravida erat magna id urna. Cras feugiat, orci nec hendrerit pulvinar, tortor mi dapibus neque, in varius massa velit vitae mi. Fusce dignissim malesuada felis in tincidunt. Donec lacus magna, blandit quis ullamcorper consectetur, interdum in nisl. Curabitur luctus lorem in leo aliquam vestibulum. Ut tempus ornare augue non aliquet. Sed id elit eget sem condimentum tempus et non libero. Proin at nisi quis dolor dignissim varius. Nam fermentum mauris eget justo laoreet vitae tristique quam varius. Praesent sodales sem sed dolor aliquet sagittis. Vestibulum fringilla ultricies nunc. In lacus nisl, mollis blandit aliquam ut, tristique in libero. Suspendisse lacinia aliquet aliquet.</p>
<pre>.alpha {
	background: -moz-linear-gradient(left, rgba(255,255,255,1),
	rgba(255,255,255,0)),
	#4aceff url(http://thepeev.com/wp-content/themes/thepeev/images/plant.png) bottom no-repeat;
}</pre>
<h2>Radial Gradients</h2>
<p>Radial gradients allow for some really cool effects like gradient &#8220;shine&#8221; and other neat things you&#8217;d otherwise have to create in Photoshop.</p>
<h3>The example:</h3>
<p class="box radial"><strong>You can even draw radial gradients. See how I shine!</strong> Donec malesuada, augue in pulvinar tincidunt, tellus lectus iaculis mi, vel facilisis ante mauris et sem. Nunc pretium orci in lacus sollicitudin rhoncus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras sollicitudin risus eu libero vestibulum vel mattis diam sagittis. Duis vel dui non erat eleifend dignissim vitae vitae dui. Curabitur dictum imperdiet diam euismod viverra.</p>
<h3>The CSS:</h3>
<pre>.radial {
	background: -moz-radial-gradient(top left, white 20%, orange);
}</pre>
<h2>Repeating Gradients</h2>
<p>As if this wasn&#8217;t enough, you&#8217;ll also have support for repeating gradients, which allows you to do some really cool stuff.</p>
<h3>Check it out:</h3>
<p class="box slasher"><strong>Repeating gradients make it easy to add slash-boxes.</strong> Vestibulum at fringilla dolor. Pellentesque id consectetur enim. Suspendisse vel nibh magna, et imperdiet mi. Aliquam erat volutpat. Maecenas dui quam, volutpat vitae cursus et, suscipit sit amet lorem. Duis congue, nisi eu aliquet ultricies, ipsum ligula rutrum libero, quis rhoncus nisi mauris lacinia nunc. Nam iaculis, nibh et faucibus tempor, massa magna eleifend urna, sit amet pulvinar arcu velit et lacus.</p>
<h3>The CSS:</h3>
<pre>.slasher {
	background: -moz-repeating-linear-gradient(left -45deg, #fff, #f5f5f5 1px, #fff 5px, #fff 1px);
}</pre>
<h3>Use it with radial gradients:</h3>
<p class="box burst"><strong>Repeating radial gradients make it easy to add special effects to your design.</strong> Aliquam tempor tempor nunc, ut dapibus nisl vehicula et. Nullam felis metus, consectetur eu pretium eu, iaculis eu tortor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Ut quis ligula orci, id molestie orci.</p>
<h3>The CSS:</h3>
<pre>.burst {
	background: -moz-repeating-radial-gradient(-5px -5px, circle, #bfeeff, #bfeeff 15px, #fff 15px, #fff 30px, #bfeeff 30px, #bfeeff 40px);
	border: 5px #bfeeff solid;
}</pre>
<h2>Background Images</h2>
<p>This is one that I&#8217;m really excited about. You can apply multiple background images to a single layer. Here&#8217;s how it works:</p>
<h3>Multiple background layers:</h3>
<p class="box layers"><strong>You can layer multiple background images on a single element. This example was taken direclty from Mozilla&#8217;s demonstration page.</strong> Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Quisque imperdiet elit dignissim libero sollicitudin tempus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Duis mattis, leo at rhoncus varius, leo eros tempus ligula, eget blandit mi tortor vitae ante. Nulla varius aliquet massa ac varius. Vestibulum a ipsum vitae ante lobortis facilisis vitae eu risus.</p>
<h3>The CSS:</h3>
<pre>.layers {
	background: url(http://demos.hacks.mozilla.org/openweb/resources/images/logos/firefox-48.png),
	-moz-linear-gradient(left, rgba(255, 255, 255, 0),  rgba(255, 255, 255, 0.8)),
	url(http://demos.hacks.mozilla.org/openweb/resources/images/patterns/flowers-pattern.jpg);
	background-repeat: no-repeat, no-repeat, repeat;
	background-position: bottom right, left, right;
	color: #fff;
}</pre>
<h3>You can also resize background images!</h3>
<p class="box sizer"><strong>You can scale a background image to any size. It&#8217;s so ugly!</strong> Morbi sapien urna, convallis quis accumsan mattis, congue non ante. Phasellus bibendum nibh id orci consequat hendrerit rhoncus in leo. Ut a mauris eu nisl accumsan pulvinar sit amet at leo. Aenean sit amet enim sit amet tellus pellentesque tempus. Vivamus lobortis dui sed arcu venenatis vel vehicula felis vestibulum. Fusce vel ipsum eu nulla fermentum gravida. Suspendisse tincidunt euismod consectetur.</p>
<h3>The CSS:</h3>
<pre>.sizer {
	background: #f5f5f5 url(http://demos.hacks.mozilla.org/openweb/resources/images/logos/firefox-48.png) bottom right no-repeat;
	-moz-background-size: 120px;
	-webkit-background-size: 120px;
	-o-background-size: 120px;
}</pre>
<h2>Other Additions</h2>
<p>Mozilla has included some other great new features, such as the highly anticipated CSS attribute <code>@font-face</code>, which allows you to embed WOFF downloadable fonts into your web design. Type is finally coming to the web! For details on this and the many other great new features in Firefox 3.6, visit Mozilla&#8217;s <a href="https://developer.mozilla.org/En/Firefox_3.6_for_developers">update details for developers</a> page.</p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/best-practices/9-amazing-things-firefox-3-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IE Corner Inserts via jQuery</title>
		<link>http://kyleschaeffer.com/tutorials/ie-corner-inserts-via-jquery/</link>
		<comments>http://kyleschaeffer.com/tutorials/ie-corner-inserts-via-jquery/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 22:51:43 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Corners]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.kyleschaeffer.com/?p=422</guid>
		<description><![CDATA[I recently had a client whose design demanded rounded corners in a lot of different areas of their site. As I looked through the design documentation, the variety and color of these rounded widgets really started to add up. I &#8230; <a href="http://kyleschaeffer.com/tutorials/ie-corner-inserts-via-jquery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I recently had a client whose design demanded rounded corners in a lot of different areas of their site. As I looked through the design documentation, the variety and color of these rounded widgets really started to add up. I quickly decided that <a href="http://www.kyleschaeffer.com/best-practices/rounded-corners-in-mozilla-and-safari/">pure CSS corners</a> were the best choice for their design. Most users can utilize <code>border-radius</code> to apply the rounded effect without any overhead (the browser does the work), and the remaining users can be handled by a quick and easy bit of jQuery.<span id="more-422"></span></p>
<h2>For the (better) browsers&#8230;</h2>
<p>It&#8217;s easy to add corners to your design in most browsers. In a previous post, I talked about the different ways to apply CSS corners within your design. Here&#8217;s what I used for this particular client.</p>
<div id="the-css">
<pre>.corners {
	-moz-border-radius: 12px;
	-webkit-border-radius: 12px;
}
.noTL {
	-moz-border-radius-topleft: 0;
	-webkit-border-top-left-radius: 0;
}
.noTR {
	-moz-border-radius-topright: 0;
	-webkit-border-top-right-radius: 0;
}
.noBL {
	-moz-border-radius-bottomleft: 0;
	-webkit-border-bottom-left-radius: 0;
}
.noBR {
	-moz-border-radius-bottomright: 0;
	-webkit-border-bottom-right-radius: 0;
}</pre>
</div>
<p>This made it extremely easy to add corners to the elements in my design. In most cases, I could simply add <code>&lt;div class=&quot;myDivClass <strong>corners</strong>&quot;/&gt;</code>, and the CSS does the rest. If I don&#8217;t want a rounded edge on a particular corner, I can just add <code>noTR</code>, <code>noBL</code>, etc. to my class list. Easy.</p>
<h2>For the other (not-so-better) browser&#8230;</h2>
<p><strong>Disclaimer:</strong> this really doesn&#8217;t do anything entirely too amazing. It&#8217;s not auto-magically generating corner images, and it&#8217;s not inserting a ton of HTML to simulate corner images (I just hate when scripts do that). This is a script I have been using for a while to add corners for IE users; basically, it builds a custom image path for each style of widget in your design marked with the <code>corners</code> CSS class. For each corners widget that my script finds, it will trace up through your HTML until it finds a parent element with a <code>background-color</code>. It then creates four <code>&lt;div/&gt;</code> tags inside your widget and positions them at the outer corners of the widget. The background-image for these <code>&lt;div/&gt;</code> tags is set to something like <strong>corners-12-ffffff.png</strong> or <strong>corners-12-ffaa10-border</strong> (if your widget has a border-width associated with it). The <code>12</code> is the radius of your corner, and <code>ffffff</code> is the background color that appears behind your widget. You&#8217;ll have to create the images yourself (and put them in the right place), but my script will handle inserting the HTML and CSS in the right place. If you create the images <a href="http://www.kyleschaeffer.com/best-practices/reusable-transparent-css-rounded-corners/">a little like this</a>, then you&#8217;ll find that your IE corners will be in place in no time at all.</p>
<p>It&#8217;s certainly not ground-breaking stuff, but it makes it very easy to reduce the overhead in your design for most users. In addition, the script is fairly small, and you&#8217;ll find it&#8217;s really not much overhead for IE users as well. Here&#8217;s how to add it to your site:</p>
<ol>
<li>You&#8217;ll need <a href="http://jquery.com/">jQuery 1.3.2</a> or later linked to your page</li>
<li>Add the <a href="#the-css">CSS (above)</a> to your style sheet. This takes care of everyone except for IE.</li>
<li>Create a new JavaScript file with the following contents:
<pre>/*******************************************

	IE Corner Inserts v1.0

	by Kyle Schaeffer

http://www.kyleschaeffer.com

	* requires jQuery 1.3.2 or later

*******************************************/

// change this path to match the path to your corner image files
var cornerImagePathPrefix = '/designImages/';

// default file extension for corner images is PNG
var cornerImageFileExtension = '.png';

// default corner radius
var cornerRadius = '12';

$(document).ready(function(){
	$('.corners').each(function(i){
		var parentDiv = $(this).parent();
		var cornerColor = null;

		// find parent background color (trace up through DOM)
		while(cornerColor == null &amp;&amp; parentDiv != null){
			if($(parentDiv).css('background-color') != 'transparent'){
				cornerColor = $(parentDiv).css('background-color');
				cornerColor = cornerColor.substr(1);
			}
			else if($(parentDiv).hasClass('bodyWrapper')){
				cornerColor = '6f98ae';
			}
			else{
				parentDiv = $(parentDiv).parent().get(0);
			}
		}

		// apply corner &lt;div/&gt; tags to elements
		if(cornerColor != null){
			// find border offsets
			var offsetTop = parseInt($(this).css('border-top-width')) || 0;
			var offsetRight = parseInt($(this).css('border-right-width')) || 0;
			var offsetBottom = parseInt($(this).css('border-bottom-width')) || 0;
			var offsetLeft = parseInt($(this).css('border-left-width')) || 0;

			// add &quot;-border&quot; to any image path (for border-only corners)
			var borderImageText = '';
			if(offsetTop &gt; 0 &amp;&amp; offsetRight &gt; 0 &amp;&amp; offsetBottom &gt; 0 &amp;&amp; offsetLeft &gt; 0){
				borderImageText = '-border';
			}

			// change color values like &quot;#fff&quot; to &quot;#ffffff&quot;
			if(cornerColor.length == 3){
				cornerColor += cornerColor;
			}

			// set position to relative (if not already set)
			if($(this).css('position') != 'absolute' &amp;&amp; $(this).css('position') != 'relative'){
				$(this).css('position','relative');
			}

			// corner image filename
			var cornerImage = 'corners-' + cornerRadius + '-' + cornerColor + borderImageText + cornerImageFileExtension;

			// add corners
			if(!$(this).hasClass('noTL')){
				var cornerDiv = $('&lt;div style=&quot;position: absolute; height: ' + cornerRadius + 'px; width: ' + cornerRadius + 'px; background: url(' + cornerImagePathPrefix + cornerImage + ') top left no-repeat;&quot;/&gt;');
				$(cornerDiv).css('top',(offsetTop * -1) + 'px');
				$(cornerDiv).css('left',(offsetLeft * -1) + 'px');
				$(this).append(cornerDiv);
			}
			if(!$(this).hasClass('noTR')){
				var cornerDiv = $('&lt;div style=&quot;position: absolute; height: ' + cornerRadius + 'px; width: ' + cornerRadius + 'px; background: url(' + cornerImagePathPrefix + cornerImage + ') top right no-repeat;&quot;/&gt;');
				$(cornerDiv).css('top',(offsetTop * -1) + 'px');
				$(cornerDiv).css('right',(offsetRight * -1) + 'px');
				$(this).append(cornerDiv);
			}
			if(!$(this).hasClass('noBL')){
				var cornerDiv = $('&lt;div style=&quot;position: absolute; height: ' + cornerRadius + 'px; width: ' + cornerRadius + 'px; background: url(' + cornerImagePathPrefix + cornerImage + ') bottom left no-repeat;&quot;/&gt;');
				$(cornerDiv).css('bottom',(offsetBottom * -1) + 'px');
				$(cornerDiv).css('left',(offsetLeft * -1) + 'px');
				$(this).append(cornerDiv);
			}
			if(!$(this).hasClass('noBR')){
				var cornerDiv = $('&lt;div style=&quot;position: absolute; height: ' + cornerRadius + 'px; width: ' + cornerRadius + 'px; background: url(' + cornerImagePathPrefix + cornerImage + ') bottom right no-repeat;&quot;/&gt;');
				$(cornerDiv).css('bottom',(offsetBottom * -1) + 'px');
				$(cornerDiv).css('right',(offsetRight * -1) + 'px');
				$(this).append(cornerDiv);
			}
		}
	});
});

String.prototype.endsWith = function(str){
	return(this.match(str+&quot;$&quot;)==str);
}</pre>
</li>
<li>Take a look at the configuration variables near the top of the script and update if needed</li>
<li>Link to your new JS file, but make sure only IE users are loading the file:
<pre>&lt;!--[if lte IE 8]&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;/path/to/IE-Corner-Inserts.js&quot;&gt;&lt;/script&gt;
&lt;![endif]--&gt;</pre>
</li>
<li>Create your corner images and place them in the correct path on your web server. I recently made available <a href="http://www.kyleschaeffer.com/best-practices/reusable-transparent-css-rounded-corners/">a corner images Photoshop template</a> if you need help getting started.</li>
</ol>
<p>That&#8217;s it! If all goes well, you should hopefully see image-based rounded corners in Internet Explorer, as well as the more simplistic CSS-powered corners in all other browsers.</p>
]]></content:encoded>
			<wfw:commentRss>http://kyleschaeffer.com/tutorials/ie-corner-inserts-via-jquery/feed/</wfw:commentRss>
		<slash:comments>9</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>
	</channel>
</rss>

