<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
   <title>Ask the CSS Guy</title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/" />
   <link rel="self" type="application/atom+xml" href="http://www.askthecssguy.com/atom.xml" />
   <id>tag:www.askthecssguy.com,2009://1</id>
   <updated>2009-06-25T23:14:44Z</updated>
   <subtitle>Providing CSS assistance and tutorials to whoever asks - askthecssguy@gmail.com</subtitle>
   <generator uri="http://www.sixapart.com/movabletype/">Movable Type 3.33</generator>

<entry>
   <title>CSS image replacement for... images?  It makes sense for print.</title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/2009/06/css_image_replacement_for_imag.html" />
   <id>tag:www.askthecssguy.com,2009://1.59</id>
   
   <published>2009-06-25T23:08:25Z</published>
   <updated>2009-06-25T23:14:44Z</updated>
   
   <summary>Sites with dark backgrounds lend themselves well to white or light-colored logos. The result can be nice on screen, but if the site is printed, there can be undesirable results: either the logo doesn&apos;t show up, or if it was...</summary>
   <author>
      <name></name>
      
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.askthecssguy.com/">
      <![CDATA[<p>Sites with dark backgrounds lend themselves well to white or light-colored logos. The result can be nice on screen, but if the site is printed, there can be undesirable results: either the logo doesn't show up, or if it was saved as a transparent gif, it shows with jagged pixelated edges where the edges are meant to blend in with a dark background color.</p>

<p><img alt="tees crossed printed logo" src="/images/090625_teesCrossedPrinted.gif"/></p>


<p>One way people get around this is by including two logos on their site, hiding the one for print in the screens css, and vice versa. It works, but it includes twice as many <code>img</code> tags as what is really necessary.</p>

<p>A method I've had success with is calling a print-optimized image in the html, and using CSS to swap out the image with a screen-friendly one.</p>

<p>Compare what happens <a href="/examples/teescrossed/index01.html">when you don't do this</a> to <a href="/examples/teescrossed/index02.html">when you do</a>.</p>


<h3>HTML</h3>

<pre><code class="html">&lt;img id="logo" src="logo_print.gif" alt="my bloggy-blog" /&gt;</code></pre>

<h3>CSS</h3>
<pre><code class="css">#logo {
   background:transparent url(logo_screen.gif) no-repeat top left;
   height:0;
   overflow:hidden;
   padding-top: 100px; /* height of logo for screen */
   width: 100px; /* width of logo for screen */
}</code></pre>

<p>The height:0; and overflow: hidden; combo makes sure that I don't see the logo intended for print on the screen.  By adding a width and padding-top to that image, I can set my screen-optimized logo as the background-image.  The width and padding-top should match the width and height of the image you want to show up.</p>

<p>This came about by reading David Shea's <a href="http://www.mezzoblue.com/tests/revised-image-replacement/">image replacement tests</a>.  I like the <a href="http://www.moronicbajebus.com/playground/cssplay/image-replacement/">Leahy</a>/<a href="http://www.kryogenix.org/code/browser/lir/">Langridge</a> method of image replacement because it requires no extra markup, but this image replacement technique has some cons (as they all do) when it is used to replace text.</p>

<h3>If it has cons, why do you think it's an ok idea?</h3>

<p>One usually reads about image replacement to replace text, and issues that typically come up are what to do when images are disabled, when CSS is disabled, or what extra markup has to be included to make the effect work.  Since I'm using image replacement technique to replace an <em>image</em>, these become non-issues.  If images are off, it's the same effect as not using the technique at all - alt attribute values are shown instead.  If CSS is off, the print-friendly logo is likely the favored image to show anyway.  Also, no extra markup is needed - we manipulate the existing <code>img</code> tag and nothing else.</p>

<p>Presenting a src for the print-optimized logo in the HTML, even though it doesn't get shown, feels a little weird, though, doesn't it?  You might feel better if you set the src for the screen-optimized logo, and then use a rule in the print style sheet to swap out for the print-optimized one.  But <a href="/examples/teescrossed/index03.html">that doesn't work</a> - remember that printing of background images is not enabled in browsers (by default, anyway).</p>

<p>So I'm sure you've seen plenty of sites that have a dark background with a white logo on them.  You may even have one yourself.  Go give them print preview and see how it's handled.  Sometimes (as in the case of this site), text is an acceptable fallback, but if the logo is set as an image, hopefully it is represented well in print.</p>
]]>
      
   </content>
</entry>
<entry>
   <title><![CDATA[Troubleshooting with &lt;base&gt;]]></title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/2009/03/troubleshooting_with.html" />
   <id>tag:www.askthecssguy.com,2009://1.58</id>
   
   <published>2009-03-20T21:06:01Z</published>
   <updated>2009-03-20T20:12:53Z</updated>
   
   <summary>As powerful as Firebug is for inserting HTML and CSS on the fly, sometimes you just want to save a local version of the page so that HTML manipulation can be saved and tested across browsers. I just wanted to...</summary>
   <author>
      <name></name>
      
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.askthecssguy.com/">
      <![CDATA[<p>As powerful as Firebug is for inserting HTML and CSS on the fly, sometimes you just want to save a local version of the page so that HTML manipulation can be saved and tested across browsers.</p>

<p>I just wanted to share a tip on how easy this is to do.  Right click, view source, and save it as an html file.  If you're lucky, the page will load right up, bringing in the CSS/JavaScript files that's being used on its original domain.</p>

<p>For some sites, you have to give a little guidance.  Like today, I went to <a href="http://www.wired.com">wired.com</a>, viewed and saved the html source.  You can view the result <a href="/examples/usingBase/as_is.html">here</a>.</p>

<p>Yuck, it's missing styles.  That's not what we wanted.</p>

<p>But by inserting a little code in <code>head</code>, we can grab everything the page uses from the site.  After the opening <code>head</code> tag, insert the following:</p>

<pre><code class="html">&lt;base href="http://www.wired.com/" /&gt;</code></pre>

<p>and then resave the file.  <a href="/examples/usingBase/adding_base.html">View the result</a>, and you should see the page just as it is meant to be seen at its original address.</p>

<p>I can modify my local copy to my heart's content, putting new or modified CSS in <code>style</code> tags until I have it just right, then commit the changes to something more permanent. I use this all the time when troubleshooting defects, especially when needing to see how inserting some new element in the HTML will affect IE.  Hopefully, it will help some of you, too.</p>

<p>And note that the wired.com example might work for today, but if they ever redesign, this article's example won't mean jack.  I apologize in advance.</p>]]>
      
   </content>
</entry>
<entry>
   <title>Checkbox filters with jQuery</title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/2009/03/checkbox_filters_with_jquery_1.html" />
   <id>tag:www.askthecssguy.com,2009://1.57</id>
   
   <published>2009-03-06T20:16:16Z</published>
   <updated>2009-03-06T20:24:11Z</updated>
   
   <summary>Perhaps I&apos;m using delicious.com wrong, but sometimes I wish I had the ability to narrow down my results from a variety of different tags rather than excluding results that don&apos;t share the first tag I marked. That&apos;s where this exercise...</summary>
   <author>
      <name></name>
      
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.askthecssguy.com/">
      <![CDATA[<p>Perhaps I'm using delicious.com wrong, but sometimes I wish I had the ability to narrow down my results from a variety of different tags rather than excluding results that don't share the first tag I marked.  That's where this exercise came into play.</p>

<p>The technique can be used anywhere. In my line of work (online hotel reservations), I've experimented with this technique for a room selection for online hotel reservations.  For instance, hide all but the non-smoking rooms with a king bed, and only show me rooms that I can pay for in advance to get the cheaper price.  That sort of thing.</p>

<p>For this article, I'm going to base my examples on delicious.com's bookmarks.</p>

<p class="entrySupportLinks"><a class="viewDemo" href="/examples/checkboxFilters/exampleFinal.html">View demo</a></p>

<h3>Disclaimer stuff</h3>
<p>This isn't so much of a 'teaching' post as it is an 'asking to be taught' post. Despite the danger I can cause, <strong>I'm no JavaScript/jQuery guy</strong>, and there are plenty of places here that I'm going about this all wrong.  In those instances, I need your help.  I'll call out some specific questions where I know I need improvement.  And if you see additional places, please let me know.  In the meantime, don't look to this post as tried-and-true, ready-to-copy-and-paste way to do things, because it's far from it.</p>


<h3>The HTML</h3>

<p>Let's recreate a delicious bookmark listing and leave out the filters for now.  Here's the html for a single listing:</p>

<pre><code class="html">&lt;ul&gt;
  ...
  &lt;li&gt;
    &lt;h4&gt;The Power of WordPress and jQuery: 25+ Useful Plugins &amp; Tutorials&lt;/h4&gt;
    &lt;p class="url"&gt;http://www.noupe.com/jquery/the-power-of-wordpress-and-jquery-30-useful-plugins-tutorials.html&lt;/p&gt;
    &lt;p class="tags"&gt;&lt;strong&gt;Tags:&lt;/strong&gt; plugin, wordpress, webdesign, jquery&lt;/p&gt;
  &lt;/li&gt;
  ...
&lt;/ul&gt;</code></pre>

<p>In order for this to work, we need a way to get the list items using class names.  So the tags are repeated as class names.  Also, I'm going to give this particular list a class name so the javascript has something to target later.</pre>

<pre><code class="html">&lt;ul <strong>class="filterThis"</strong>&gt;
  ...
  &lt;li <strong>class="plugin wordpress webdesign jquery"</strong>&gt;
    &lt;h4&gt;The Power of WordPress and jQuery: 25+ Useful Plugins &amp; Tutorials&lt;/h4&gt;
    &lt;p class="url"&gt;http://www.noupe.com/jquery/the-power-of-wordpress-and-jquery-30-useful-plugins-tutorials.html&lt;/p&gt;
    &lt;p class="tags"&gt;&lt;strong&gt;Tags:&lt;/strong&gt; plugin, wordpress, webdesign, jquery&lt;/p&gt;
  &lt;/li&gt;
  ...
&lt;/ul&gt;</code></pre>

<p>We create several of these records and we have ourselves a nice delicious-like page of results.</p>

<p class="entrySupportLinks"><a class="viewDemo" href="http://www.askthecssguy.com/examples/checkboxFilters/example1.html">View example 1</a> - the starting point: basic page, no javascript</p>

<h3>Let's say it in English</h3>
<p>The JavaScript for this is kind of long and boring, not to mention that I'm not doing it right in several places.  So instead of reprinting it, I'd rather just say in English what I wanted the JavaScript to do.  Writing out the logic in English is always a good practice anyway. So here goes:</p>

<p>When the page loads, look through all the class names of the list items to be filtered, and build a new list with all the unique values of those class names, along with a corresponding checkbox.  Being friendly, we'll also include a 'show all' checkbox at the end of the list.  Since all items are shown by default, all checkboxes will be shown by default, too.  When someone unchecks a box, hide any item that has the class name of that checkbox's value.  When rechecked, show any item that has the class name of that checkbox's value.</p>

<p>Mouthful, right?  There's much more to come, as I quickly realized that there is more I needed to do with this list.</p>

<p class="entrySupportLinks"><a class="viewDemo" href="http://www.askthecssguy.com/examples/checkboxFilters/example2.html">View example 2</a> - the starting point: basic page, no javascript</p>

<h3>Working through one issue at a time</h3>

<p>Issues I immediately noticed with example 2:</p>
<ol>
	<li>'jquery' is a common tag to every item.  How should that be handled?</li>
	<li>When i uncheck 'webdev', an item that has the class of 'resources' also disappears.  It's the only item with the class of 'resources', yet it's checkbox stays checked, misleading me into thinking that because it's checked, there must be a listing showing that has it.</li>
	<li>It would be nice to alphabetize the filters.</li>
</ol>

<p>The latter one was the easiest to knock out.  I can sort the array of unique class names by adding this line to the JavaScript:</p>

<pre><code class="js">arrayUniqueClasses = arrayUniqueClasses.sort();
</code></pre>

<p>Also, I chose to exclude any class that is common to all elements from being in the filter column.  (My code is probably cruddy for doing this - would love feedback on this.) For sake of demonstration, I created a paragraph above the filters that states which classes those are common to all list items.</p>

<p class="entrySupportLinks"><a class="viewDemo" href="http://www.askthecssguy.com/examples/checkboxFilters/example3.html">View example 3</a> - alphabetized filters, and excluding tags common to all list items.</p>

<p>I noticed an additional challenges:</p>
<ol>
	<li>When a filter is unchecked, before hiding the list item, I need to check other classes on the list item to be hidden.</li>
	<li>When a filter is checked again, in addition to showing the list item, I need to check all the other filters for every other class associated with a newly shown list item.</li>
	<li>For my personal preference, I wanted to add this in: If all other filters are checked, go ahead and recheck the 'show all' checkbox.</li>
</ol>

<p>To see how I tackled these challenges, I recommend viewing source on the examples.  The script is commented with what I'm doing and questions to myself throughout the process.</p>

<p class="entrySupportLinks"><a class="viewDemo" href="/examples/checkboxFilters/exampleFinal.html">View final example</a></p>

<h3>Questions for people with more jQuery/JavaScript experience than me:</h3>

<ul>
	<li>In order to have only unique values in my array, I'm using a function called <code>unique(a)</code> (credit: Johan Känngård, http://johankanngard.net/). I tried to use jQuery.unique, but it wasn't working right.  If anyone can do the unique part in jQuery for me and point out how it's done, I'd be much appreciative.</li>
	<li>I'm using what is probably an unreliable method for determining if a tag is common to every result.  I count the number of list items, and I count the number of times any class appears.  If a class's total occurrences equals the total of all list items, I assume that class is common to all list items.  Is there a better way to do this?</li>
	<li>I'm removing items from my arrays using a <code>removeItems(array, item)</code> function that I got from who-knows-where.  Is there a way I can do this in jQuery?</li>
<li>Any other things that could be done better?</li>
</ul>
]]>
      
   </content>
</entry>
<entry>
   <title>How to make a &apos;wall of awesome&apos; with CSS and an animated gif</title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/2009/01/how_to_make_a_wall_of_awesome_1.html" />
   <id>tag:www.askthecssguy.com,2009://1.56</id>
   
   <published>2009-01-30T04:46:11Z</published>
   <updated>2009-01-30T04:53:54Z</updated>
   
   <summary> My coworker Alan sent me a link to moustacheme.com last week. Moustacheme.com has a wall of awesome, which is a gallery of moustachioed photos (perhaps it could be called a &quot;stash of staches&quot;, or a &quot;stache-cache&quot;), and it uses...</summary>
   <author>
      <name></name>
      
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.askthecssguy.com/">
      <![CDATA[<p><img src="/images/20090130_wallOfAwesome.jpg" alt="moustacheme.com wall of awesome" /></p>

<p>My coworker <a href="http://www.tugbucket.net/">Alan</a> sent me a link to <a href="http://moustacheme.com">moustacheme.com</a> last week.  Moustacheme.com has a <a href="http://moustacheme.com/wall-of-awesome/">wall of awesome</a>, which is a gallery of moustachioed photos (perhaps it could be called a "stash of staches", or a "stache-cache"), and it uses a clever CSS technique for an attention-getting effect on hover.</p>

<p>Let's recreate it.</p>

<h3>The HTML</h3>

<p>We want a thumbnail container, with our link inside of it.  The thumbnail image is inside the link.  The thumbnail containers are at a fixed dimension (thanks to the thumb) and will simply float left and repeat .</p>

<p>So this:</p>

<pre><code class="html">&lt;div class="thumbnail"&gt;
  &lt;a href="#"&gt;
    &lt;img src="thumb.gif" alt="" /&gt;
  &lt;/a&gt;
&lt;/div&gt;</code></pre>

<p>repeated a few times and put in a container, like so:</p>

<pre><code class="html">&lt;div class="container"&gt;
  &lt;div class="thumbnail"&gt;...&lt;/div&gt;
  &lt;div class="thumbnail"&gt;...&lt;/div&gt;
  &lt;div class="thumbnail"&gt;...&lt;/div&gt;
  ...
&lt;/div&gt;</code></pre>

<p class="entrySupportLinks"><a class="viewDemo" href="http://www.askthecssguy.com/examples/wallOfAwesome/example01.html">View example 1</a></p>

<h3>Some basic layout CSS</h3>

<p>Right off the bat, I want to layout my thumbs a little better, like a 9x9 grid. So I'll start with that first.</p>

<pre><code class="css">.container { width: 470px; }
.thumbnail { float:left; }
.thumbnail a img { display:block; border:none; }</code></pre>

<p class="entrySupportLinks"><a class="viewDemo" href="http://www.askthecssguy.com/examples/wallOfAwesome/example02.html">View example 2</a></p>

<p>Now let's get awesome.</p>

<h3>Awesome CSS</h3>

<p>To get awesome, we need to find a nice high-contrast animated gif to assist our hover state.  I could use the <a href="http://moustacheme.com/wall-of-awesome/images/star.gif">star blast used on moustacheme.com</a>, but those are cut to the size used on that site, so I think I'll create my own little <a href="http://www.askthecssguy.com/examples/wallOfAwesome/images/spiral.gif">animated spiral</a> based on a rough gif I found on the internets.</p>

<p>We set that image as the background of our thumbnail div.  The awesomeness is baked into place once the opacity of the thumbnail image is changed on hover.</p>

<pre><code class="css">.container { width: 470px; }
.thumbnail { float:left; background:transparent url(images/spiral.gif) no-repeat 50% 50%; }
.thumbnail a img { display:block; border:none; }
.thumbnail a:hover img {
  opacity: 0.8;
  filter: alpha(opacity = 80); /* for IE */
}
</code></pre>

<p class="entrySupportLinks"><a class="viewDemo" href="http://www.askthecssguy.com/examples/wallOfAwesome/example03.html">View example 3</a></p>

<p>I'm certain this could be done with less markup.  For instance, we don't need a div.thumbnail.  Our &lt;a&gt; tag can be the thumbnail - set it to display block and attach the background image to it.</p>

<p class="entrySupportLinks"><a class="viewDemo" href="http://www.askthecssguy.com/examples/wallOfAwesome/example04.html">View example 4</a></p>

<h3>In summary</h3>
<p>Ok, so my wall of awesome featuring images from the Men Who Look Like Kenny Rogers web site is not as awesome as moustacheme.com's wall, but you get the idea.</p>
]]>
      
   </content>
</entry>
<entry>
   <title>Mike asks the CSS Guy about a scrolling trick with background images</title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/2009/01/mike_asks_the_css_guy_about_a.html" />
   <id>tag:www.askthecssguy.com,2009://1.55</id>
   
   <published>2009-01-13T22:27:30Z</published>
   <updated>2009-01-14T22:11:03Z</updated>
   
   <summary> Mike writes: Check this out: http://econsultancy.com/reports.Scroll up/down... whaaaaat? :) How was this done? Answer: fixed background images. Let&apos;s look at some examples. Images For the basic effect, start with two same sized images, with a slight difference. For my...</summary>
   <author>
      <name></name>
      
   </author>
         <category term="ringmaster" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://www.askthecssguy.com/">
      <![CDATA[ <p>Mike writes:</p>

<blockquote><p>Check this out: <a href="http://econsultancy.com/reports">http://econsultancy.com/reports</a>.</p><p>Scroll up/down... whaaaaat? :) How was this done?</p></blockquote>

<p>Answer: fixed background images.  Let's look at some examples.</p>

<h3>Images</h3>
<p>For the basic effect, start with two same sized images, with a slight difference.  For my example, I chose this color image and made second version of it in black and white.</p>

<p><img alt="" src="/examples/fixedBackgroundImages/images/cuckoo_color.jpg"/><img alt="" src="/examples/fixedBackgroundImages/images/cuckoo_bw.jpg"/></p>

<p>The images don't have to be the same size, but that definitely makes it easier.</p>

<h3>The markup</h3>

<p>Each image will need it's only container.  I've used a header div and a content div.</p>

<pre><code class="html">&lt;html&gt;
  &lt;head&gt;
    ... 
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div class="header"&gt;
      ...
    &lt;/div&gt;
    &lt;div class="content"&gt;
      ...
    &lt;/div&gt;
  &lt;/body&gt;
&lt;/html&gt;</code></pre>

<h3>The CSS</h3>

<p>Now you assign each image as the background image of each div.  The positioning should always be the same, and <code>background-attachment</code> should be set to <code>fixed</code>.

<pre><code class="css">...
.header {
  padding:40px 40px 40px 300px;
  background: #dbded1 url(images/cuckoo_color.jpg) no-repeat 20px 20px fixed;
}
...
.content {
  padding:10px 40px 10px 300px;
  background: transparent url(images/cuckoo_bw.jpg) no-repeat 20px 20px fixed;
}
...</code></pre>

<p class="entrySupportLinks"><a href="/examples/fixedBackgroundImages/example01.html" class="viewDemo">View example 1</a></p>

<p>I've kept this example basic.  If your browser is wide enough by default, the two images are already seen at the same time.  That's ok just for purposes of illustration.</p>

<p>And knowing this can be done, there's no reason it has be limited to just two images.</p>

<p class="entrySupportLinks"><a href="/examples/fixedBackgroundImages/example02.html" class="viewDemo">View example 2</a></p>

<h3>So what can be done with it?</h3>

<p>This 'effect' isn't inherently bad or annoying, but it is noticeable enough that I'd rather it exist for a reason - where the effect adds some value to the content.  Otherwise, like in the case of econsultancy, it just seems like an excuse to show both the home and away jersey, as if someone couldn't decide which logo to go with, so they came up with a way to use both.</p>

<p>I took a stab at it.  Maybe a paper shredder web page?</p>

<p class="entrySupportLinks"><a href="/examples/fixedBackgroundImages/example03.html">View example 3</a></p>

<p>Or maybe not...</p>
<p>If you've seen technique this used effectively, let me know in the comments.</p>

<div class="updates">
<p><strong>Jan 14, 2009:</strong> Some readers of reddit mention that the following sites that have used fixed background images to achieve a nice effect:</p>
<ul>
	<li>Eric Meyer's <a href="http://meyerweb.com/eric/css/edge/complexspiral/demo.html">complexspiral demo</a> uses fixed background images to fake transparency</li>
	<li>Bryan Katzel's <a href="http://www.webleeddesign.com/">We Bleed Design</a> portfolio. (Click the 'play' link at the top, sit back, and enjoy).</li>
</ul>
</div>
]]>
      
   </content>
</entry>
<entry>
   <title>Josh asks the CSS Guy about row locking with jQuery</title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/2008/10/josh_asks_the_css_guy_about_ro.html" />
   <id>tag:www.askthecssguy.com,2008://1.54</id>
   
   <published>2008-10-22T14:49:22Z</published>
   <updated>2008-10-22T14:50:03Z</updated>
   
   <summary> With regards to this article, Josh writes: &quot;Would it be possible for you to recreate this with jQuery and see how many lines of JS you can save in the process?&quot; Yes! View demo This is a direct jQuery...</summary>
   <author>
      <name></name>
      
   </author>
         <category term="tiger" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://www.askthecssguy.com/">
      <![CDATA[  <p>With regards to <a href="http://www.askthecssguy.com/2006/12/row_locking_with_css_and_javas.html">this article</a>, Josh writes:</p>

<blockquote><p>"Would it be possible for you to recreate this with jQuery and see how many lines of JS you can save in the process?"</p></blockquote>

<p>Yes!</p>

<p class="entrySupportLinks"><a href="/examples/rowlock/example10.html" class="viewDemo">View demo</a></p>

<p>This is a direct jQuery replacement of <a href="/examples/rowlock/example9.html">this particular example</a>.</p>

<h3>The jQuery</h3>

<p>I ditched all the home-grown functions, linked  out to the <a href="http://code.jquery.com/jquery-latest.js">jQuery-latest.js</a>, then wrote the following bits:</p>

<pre><code class="js">$(document).ready(function() {
  $('.pickme tbody tr:odd').addClass('odd');
  $('.pickme tbody tr').hover(
    function() { $(this).addClass('highlight'); },
    function() { $(this).removeClass('highlight'); }
  ).click( function() {
    $('.selected').removeClass('selected');
    $(this).addClass('selected').find('input').attr('checked','checked');
  });
});</code></pre>

<p>In English, this says:</p>
<ol>
	<li>When the page has finished loading the DOM...</li>
	<li>add a class of 'odd' to every other row in the table...</li>
	<li>then assign a hover behavior that consists of:</li>
	<li>adding a class of 'highlight' to the row when hovered into...</li>
	<li>and removing the class of 'highlight' when hovered away.</li>
	<li>When any row is clicked...</li>
	<li>remove the class of 'selected' from any other row that happens to have it...</li>
	<li>then add class of 'selected' to the current row, while also checking it's radio button.</li>
</ol>

<p>This is much shorter and easier to write for than the previous example.  Compare the javascript written in the source code on the <a href="/examples/rowlock/example9.html">previous version</a> to the <a href="/examples/rowlock/example10.html">jQuery version</a>.</p>

<p>The usual warnings for using libraries still apply.  If it's a single effect on your site, it is likely best and more concise to write out your functions from scratch, but if you are already using jQuery (or any other library) on your site, take advantage of it.  Also, just because it's easy doesn't make it right - give consideration to whether a behavior should be applied at all.</p>]]>
      
   </content>
</entry>
<entry>
   <title>Pardon the mess</title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/2008/09/pardon_the_mess.html" />
   <id>tag:www.askthecssguy.com,2008://1.53</id>
   
   <published>2008-09-04T19:39:51Z</published>
   <updated>2008-09-13T02:54:48Z</updated>
   
   <summary>I&apos;m gutting some movable type html, and along with that, I&apos;ll need to rebuild the CSS file as well. If you keep seeing fresh articles in your feed reader, this is why. This will take a few days. Sep 12,...</summary>
   <author>
      <name></name>
      
   </author>
   
   
   <content type="html" xml:lang="en" xml:base="http://www.askthecssguy.com/">
      <![CDATA[<p>I'm gutting some movable type html, and along with that, I'll need to rebuild the CSS file as well.  If you keep seeing fresh articles in your feed reader, this is why.  This will take a few days.</p>

<div class="updates">
<p><strong>Sep 12, 2008:</strong> I suppose it could be considered subjective, but the 'mess' has been straightened up.  I still have some entries to edit to bring up to column standards (why didn't I do this sooner?), but things are falling into place, and I'm learning plenty in the process.  I've got a vacation coming up, but hope to get some articles currently in the works on the site soon after my return.</p>
</div>]]>
      
   </content>
</entry>
<entry>
   <title>A page curling tip</title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/2008/08/a_page_curling_tip.html" />
   <id>tag:www.askthecssguy.com,2008://1.52</id>
   
   <published>2008-08-22T00:24:52Z</published>
   <updated>2008-09-10T23:51:19Z</updated>
   
   <summary>Some have asked how to do the page curl effect for the figures in the article I wrote for Smashing Magazine, which included figures with page curls. The answer is Veerle&apos;s tutorial. There is one extra tip I&apos;d like to...</summary>
   <author>
      <name></name>
      
   </author>
         <category term="popcorn" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://www.askthecssguy.com/">
      <![CDATA[<p>Some have asked how to do the page curl effect for the figures in the <a href="http://www.smashingmagazine.com/2008/08/18/7-principles-of-clean-and-optimized-css-code/">article I wrote for Smashing Magazine</a>, which included figures with page curls.</p>

<p>The answer is <a href="http://veerle.duoh.com/blog/comments/creating_a_page_curl_in_photoshop/">Veerle's tutorial</a>.</p>

<p>There is one extra tip I'd like to offer.</p>

<p>In Step 2 of Veerle's directions, she states the following:</p>

<blockquote><p>"Since this curl doesn't show the back of our photo, it doesn't really look realistic. The only way I'm aware of to achieve this effect is that <em>we draw it ourself</em>. Select the Pen tool from the Toolbox and draw a path on top of the picture. <em>Follow the borders of the curl you just transformed as guidance</em>. ..."</p></blockquote>

<p>Emphasis mine.</p>

<p>Tracing the curl with the Pen tool can be difficult when the contrast between the curled edge and the 'facing' edge of the photo is too faint.  For instance, if you went through the tutorial with a blank beige square, your progress as you get to step 2 may look like this:</p>

<p>Stage 1: Drawing the marquee</p>
<p><img src="http://askthecssguy.com/images/080821_fig1.gif" alt="" /></p>

<p>Stage 2:  Select to warp</p>
<p><img src="http://askthecssguy.com/images/080821_fig2.gif" alt="" /></p>

<p>Stage 3:  Drag the corner</p>
<p><img src="http://askthecssguy.com/images/080821_fig3.gif" alt="" /></p>

<p>Stage 4: Hit enter</p>
<p><img src="http://askthecssguy.com/images/080821_fig4.gif" alt="" /></p>

<p>Uh-oh!  Now what do we trace to make the curl? You can make it up if you're so inclined, but if you want a guide to trace, do the following:</p>

<ol>
<li>Take a screen grab just <em>before you hit enter</em>.</li>
<li>Press enter to commit your warp.</li>
<li>Paste in your screen grab over your working page layer.</li>
<li>Change the opacitiy of the screen grab layer so you can line it up with the layer underneath.</li>
<li>Now you should have guides to draw your curl.</li>
</ol>

<p><img src="http://askthecssguy.com/images/080821_fig5.gif" alt="" /></p>

<p>Once you've drawn your curl with the pen tool, you can trash the layer and go about the other steps in Veerle's tutorial to finish out the effect.</p>]]>
      
   </content>
</entry>
<entry>
   <title>Adding classes to input tags as a matter of course</title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/2008/07/adding_classes_to_input_tags_a.html" />
   <id>tag:www.askthecssguy.com,2008://1.51</id>
   
   <published>2008-07-09T21:21:42Z</published>
   <updated>2008-11-24T04:18:23Z</updated>
   
   <summary><![CDATA[I felt like sharing a practice that I've been doing for a while now when marking up form elements. I always assign a class to every input that is the same to the input's type. &lt;input type="text" class="text" /&gt; &lt;input...]]></summary>
   <author>
      <name></name>
      
   </author>
         <category term="ringmaster" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://www.askthecssguy.com/">
      <![CDATA[<p>I felt like sharing a practice that I've been doing for a while now when marking up form elements.</p>

<p>I always assign a class to every input that is the same to the input's type.</p>

<pre><code class="html">&lt;input
  type="text"
  class="text" /&gt;

&lt;input
  type="checkbox"
  class="checkbox" /&gt;

&lt;input
  type="radio"
  class="radio" /&gt;

&lt;input
  type="button"
  class="button" /&gt;</code></pre>

<p>For input types that would be similar in presentation, I double up:</p>

<pre><code class="html">&lt;input
  type="submit"
  class="submit button" /&gt;

&lt;input
  type="password"
  class="password text" /&gt;</code></pre>


<p>It's not uncommon for a project to require specified padding, width, and border colors for text inputs.  I don't want to target all input tags, as it could have some unintended consequences for elements I don't want changed.  So this practice has helped me greatly.  Its html file size impact is miniscule, and it's also easy to remember, since the type value is always the class value.</p>

<h3>Attribute selectors vs. class names</h3>
<p>Attribute selectors almost remove the need for me to do this, but not quite.  By attribute selectors, I mean the following:</p>

<pre><code class="css">input[type="text"] { border:1px solid #000; }</code></pre>

<p>... in which the value of the 'type' attribute is used instead of a class or id.</p>

<p>The main reason attribute selectors don't do the trick is that IE6 doesn't support them.  And though I can be persuaded to let a little IE6 wonkiness slip through for some parts of web site projects, forms are where I draw the line.  After all, forms are how get feedback and money from customers - why screw with that?</p>

<p>The secondary reason can be found from the password input example above.  I want password inputs to inherit the same presentational treatment as text inputs.  Using the class names defined above lets me do that.</p>

<p>For me, this practice has proven pretty effective.  Your mileage may vary, but I'd love to hear any other tips you have in mind.</p>



<p>See also:</p>
<ul>
<li>Eric Meyer's <a href="http://meyerweb.com/eric/thoughts/2007/05/15/formal-weirdness/">Formal Wierdness</a></li>
<li>Roger Johansson's <a href="http://www.456bereastreet.com/archive/200705/why_styling_form_controls_with_css_is_problematic/
">Why styling form controls with CSS is problematic</a></li>
</ul>]]>
      
   </content>
</entry>
<entry>
   <title>Kotatsu - a simple html table generator</title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/2008/04/kotatsu_a_simple_html_table_ge.html" />
   <id>tag:www.askthecssguy.com,2008://1.50</id>
   
   <published>2008-04-25T17:05:54Z</published>
   <updated>2008-09-10T23:51:22Z</updated>
   
   <summary>It&apos;s been a long time since I&apos;ve used Dreamweaver for web development. I only find myself missing it when I need to create a table, especially when I want to have all cells in a particular column have a class....</summary>
   <author>
      <name></name>
      
   </author>
         <category term="tiger" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://www.askthecssguy.com/">
      <![CDATA[<p>It's been a long time since I've used Dreamweaver for web development.  I only find myself missing it when I need to create a table, especially when I want to have all cells in a particular column have a class.  (I'm well aware of <code>&lt;colgroup&gt;</code>, I just don't subscribe.)</p>

<p>So I created a tool to help create a table and throw in column classes quickly.  I gave it a name so I can put it out there and let others use it, too.</p>

<p>It's called <a href="/kotatsu/index.html">kotatsu</a>.</p>]]>
      
   </content>
</entry>
<entry>
   <title>Prasun asks the CSS Guy how to switch the &quot;on&quot; state of navigation links for dynamic pages</title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/2008/04/prasun_asks_the_css_guy_how_to_1.html" />
   <id>tag:www.askthecssguy.com,2008://1.49</id>
   
   <published>2008-04-21T19:26:26Z</published>
   <updated>2008-09-11T04:53:40Z</updated>
   
   <summary>Prasun writes: I have a list of links in an unordered list. What I want is that when I click a list item, its color should change, and when I click some other list item, the color of the item...</summary>
   <author>
      <name></name>
      
   </author>
         <category term="popcorn" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://www.askthecssguy.com/">
      <![CDATA[<p>Prasun writes:</p>

<blockquote>
<p>I have a list of links in an unordered list. What I want is that when I click a list item, its color should change, and when I click some other list item, the color of the item which I clicked previously should return to its original state.</p>

<p>Can you help me in this regard?</p>
</blockquote>

<p>Yes, I can help.</p>

<p>More advanced readers, move along.  This is JavaScript beginner territory, but this is one of those steps that is really rich in DOM scripting nutrients, so I'm very pleased to discuss it.</p>

<p>What Prasun is describing, just by itself, is the behavior of a set of radio buttons.  You click one, and it takes on the selected state.  Then you click on another one, and the new one now becomes selected, while the previous one returns to an unselected state.</p>

<p>But radio buttons are form elements, not navigational elements, and upon clarifying with Prasun, it's navigation that we're after.</p>

<p>This is the fundamental behavior of a site that uses ajax for navigation or tabs, where each "page" is created by loading new content into the content section of the current page.</p>

<p>This is a relatively easy way to get your feet wet with DOM scripting.  So I'll first show how to do it with some very basic JavaScript functions.  Also, I'll show how to do it with jQuery.</p>

<h3>First, the HTML</h3>
<p>Let's start with an unordered list of links.</p>
<pre><code>&lt;ul&gt;
  &lt;li&gt;&lt;a href="#"&gt;Heartbreak Hotel&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Blue Suede Shoes&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Hound Dog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Don't Be Cruel&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Teddy Bear&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</code></pre>

<p>See <a href="/examples/prasun/example1.html">example 1</a>.</p>

<p>Who are we kidding?  Let's see it with some basic styling - <a href="/examples/prasun/example2.html">example 2</a>.</p>

<p>Since we're going to be changing around selected links, let's establish what a selected state looks like, and mark one item as selected by default.  I'm going to do this by applying <code>class="selected"</code> to one of the links.</p>

<pre><code>&lt;ul&gt;
  &lt;li&gt;&lt;a href="#"&gt;Heartbreak Hotel&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Blue Suede Shoes&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#" <strong>class="selected"</strong>&gt;Hound Dog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Don't Be Cruel&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="#"&gt;Teddy Bear&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</code></pre>

<p>See <a href="/examples/prasun/example3.html">example 3</a>.</p>

<h3>The JavaScript</h3>

<p>Here's what we want to do in English.  When someone clicks a link, remove class="selected" from any of the other links, and assign it to this one.</p>

<p>Another way to say that is "When someone clicks a link, run a function" and later I can be more specific about what that function is.  Here's how I'll put that statement in the html.</p>

<pre><code>&lt;ul&gt;
  &lt;li&gt;&lt;a <strong>onclick="applySelectedTo(this);"</strong> href="#"&gt;Heartbreak Hotel&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a <strong>onclick="applySelectedTo(this);"</strong> href="#"&gt;Blue Suede Shoes&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a <strong>onclick="applySelectedTo(this);"</strong> href="#" class="selected"&gt;Hound Dog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a <strong>onclick="applySelectedTo(this);"</strong> href="#"&gt;Don't Be Cruel&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a <strong>onclick="applySelectedTo(this);"</strong> href="#"&gt;Teddy Bear&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</code></pre>

<p>The "this" mentioned in the parentheses refers to the link that is being clicked.  I'm thinking ahead here - I know that I'll want to do something with the link being clicked (assign it class="selected"), so I'm going to go ahead and pass that link as a <em>parameter</em> to the function.  The term <em>this</em> is great for that sort of thing.</p>

<p>The function will be called "applySelectedTo()", and I'll write it in just a second.  It's going to do exactly what it says it will do: Apply class="selected" to whatever link is given to it.  It will also live in head of the document.</p>

<p>Notice that in the html, I'm passing the parameter <em>this</em>.  And when I write the function, I'm using a made up term to help tell me what <em>this</em> was - the word <em>link</em>.</p>

<pre><code>&lt;script type="text/javascript"&gt;
function applySelectedTo(link) {
  link.className = "selected";
}
&lt;/script&gt;</code></pre>

<p>Check out <a href="/examples/prasun/example4.html">Example 4</a> to see it in action.</p>

<h3>Oh, but we're not done</h3>

<p>All that JavaScript function did was add class="selected" to the new link.  It didn't remove class="selected" from previously selected links.  We need to fix that.  Also, when we click a link, it adds the hash mark (#) to our url, and if our page were really long, it would jump to the top of the page again.</p>

<p>We'll tackle the second problem first.  That hash mark is telling me something: it's indicating that the link is behaving like a link is supposed to behave.  That behavior normally means that it will find the <code>id</code> of whatever I specified after the hash mark and the browser will bring that part of the page in focus.  But in this case, we would rather ignore the default behavior of the link, so I'm going to tell my links to ignore their default behavior when clicked.</p>

<pre><code>&lt;ul&gt;
  &lt;li&gt;&lt;a onclick="applySelectedTo(this);<strong>return false;</strong>" href="#"&gt;Heartbreak Hotel&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a onclick="applySelectedTo(this);<strong>return false;</strong>" href="#"&gt;Blue Suede Shoes&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a onclick="applySelectedTo(this);<strong>return false;</strong>" href="#" class="selected"&gt;Hound Dog&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a onclick="applySelectedTo(this);<strong>return false;</strong>" href="#"&gt;Don't Be Cruel&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a onclick="applySelectedTo(this);<strong>return false;</strong>" href="#"&gt;Teddy Bear&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</code></pre>

<p><a href="/examples/prasun/example5.html">Example 5</a></p>

<p>And back to the first problem - removing class="selected" from other links when a new link is selected.  How do we get the link that already has class="selected", and remove the class?  Well, to make it easy, I'm just going to say remove class="selected" from <strong>all</strong> links, <em>then</em> I'll add class="selected" to the one just clicked.</p>

<pre><code>&lt;script type="text/javascript"&gt;
function applySelectedTo(link) {
  <strong>var ul = document.getElementsByTagName("ul")[0];
  var allLinks = ul.getElementsByTagName("a");
  for (var i=0; i&lt;allLinks.length; i++) { 
    allLinks[i].className = ""; 
  }</strong>
  link.className = "selected"; 
}
&lt;/script&gt;</code></pre>

<p>And so there you have it, <a href="/examples/prasun/example6.html">Example 6 - final example</a>.</p>

<p>And if you're so inclined, <a href="/examples/prasun/example7.html">make it do something</a>.</p>

<h3>We could go much further</h3>

<p>Ideally, you wouldn't even have an onclick attribute in the markup.  That kind of thing can be inserted dynamically using more DOM scripting.  It makes your html lots more readable and reusable, as well as separating behavior from structure.</p>

<p>Also, for kicks, <a href="/examples/prasun/example8.html">here's one final example</a> of doing the things mentioned in this article, but using the jQuery library instead of self-written scripts.  In the instance that you are already pulling in a hefty JavaScirpt library into your web site, you might as well make use of it.</p>]]>
      
   </content>
</entry>
<entry>
   <title>Can deprecated tags become undeprecated?</title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/2008/04/can_deprecated_tags_become_und.html" />
   <id>tag:www.askthecssguy.com,2008://1.48</id>
   
   <published>2008-04-01T15:02:39Z</published>
   <updated>2008-09-11T04:54:07Z</updated>
   
   <summary><![CDATA[When certain tags become deprecated, they become so because they are replaced by more favorable ways of achieving their original purpose. (In the case of &lt;blink&gt;, being annoying helped it along the path of deprecation.) But there's one tag that...]]></summary>
   <author>
      <name></name>
      
   </author>
         <category term="ringmaster" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://www.askthecssguy.com/">
      <![CDATA[<p>When certain tags become deprecated, they become so because they are replaced by more favorable ways of achieving their original purpose.  (In the case of <code>&lt;blink&gt;</code>, being annoying helped it along the path of deprecation.)  But there's one tag that may be coming back to life.</p>

<h3>The value of &lt;u&gt;</h3>

<p>The <code>&lt;u&gt;</code>, whose sole purpose was to underline inline text, was deprecated in HTML 4.01, and was destined to remain unsupported in future versions of HTML.  However, arguments have recently been made to revive it in HTML 5, warning that <code>&lt;u&gt;</code> has a specific value that no other tag has, and that we never should've given <code>&lt;u&gt;</code> up.  Watch <a href="http://www.youtube.com/watch?v=eBGIQ7ZuuiU">Tim Berners-Lee</a> defend this proposition to the World Wide Web Consortium in a heated March 2008 discussion.</p>]]>
      
   </content>
</entry>
<entry>
   <title>One pixel notched corners as used by Google Analytics</title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/2008/03/one_pixel_notched_corners_as_u.html" />
   <id>tag:www.askthecssguy.com,2008://1.47</id>
   
   <published>2008-03-28T21:09:48Z</published>
   <updated>2008-09-10T23:51:24Z</updated>
   
   <summary>I use Google Analytics, and I noticed that their left nav has an interesting characteristic: instead of each option being boxed in a clickable rectangle, there is a one pixel notch in each corner. It&apos;s not necessarily a curved corner,...</summary>
   <author>
      <name></name>
      
   </author>
         <category term="tiger" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://www.askthecssguy.com/">
      <![CDATA[<p>I use Google Analytics, and I noticed that their left nav has an interesting characteristic: instead of each option being boxed in a clickable rectangle, there is a one pixel notch in each corner.  It's not necessarily a curved corner, but it is a little softer than a normal box.</p>

<p><img src="/images/080328_analyticsnav.gif" alt="Google Analytics Nav uses has a one pixel notch in each corner." /></p>

<p>I would've naturally thought that if someone is going to use background images to create a capsule effect, they would have used anti-aliased images.  But upon closer inspection, no background images were used at all.  Instead, a couple of nested tags within the link help create the effect.  Instead of this:</p>

<pre><code>&lt;ul&gt;
  &lt;li&gt;
    &lt;a href="/"&gt;
      Visitors
    &lt;/a&gt;
  &lt;/li&gt;
&lt;/ul&gt;</code></pre>

<p>Some <code>&lt;b&gt;</code> tags are added (likely chosen because because of their length - one letter):</p>

<pre><code>&lt;ul&gt;
  &lt;li&gt;
    &lt;a href="/"&gt;
      <strong>&lt;b&gt;
        &lt;b&gt;
          &lt;b&gt;</strong>
            Visitors
          <strong>&lt;/b&gt;
        &lt;/b&gt;
      &lt;/b&gt;</strong>
    &lt;/a&gt;
  &lt;/li&gt;
&lt;/ul&gt;</code></pre>

<p>Now whether or not this is the purest thing to do is not the subject of this article.  Obviously, I don't support <em>over</em>nesting of tags.  But the Analytics designers did this for a specific design purpose.  Nesting one tag is quite common for achieving sliding-doors rounded tabs.  Perhaps the reasoning was, 'Why not nest two more and drop the use of images?'</p>

<p>Also, similar techniques exist out there to get rounded borders with a greater radius than just one pixel.  However, those techniques involve much more extra markup (or javascript to create it for them) in the form of empty tags, where success comes in the form of a pixelated curve reminiscent of an 8-bit Nintendo display.  (I exaggerate, <a href="http://www.cssplay.co.uk/boxes/snazzy.html">but still</a>.)   In the case of a one pixel notch, the effect at least looks intentional. </p>

<p>The notched corner is created by modifying the nested tags' border and position properties.</p>

<p>Here's the CSS:</p>

<pre><code>li a {
  display:block; <span style="color:#999;">/* a must */</span>
  border: solid #666;
  border-width: 0 1px; <span style="color:#999;">/* left and right borders only */</span>
  text-decoration: none;
  outline:none; <span style="color:#999;">/* so as not to distract from the effect */</span>
  color: #000;
  background: #e4e4e4;
}
li a b {
  display: block; <span style="color:#999;">/* another must */</span>
  position:relative; <span style="color:#999;">/* because the child elements are positioned */</span>
  top: -1px; <span style="color:#999;">/* drag it up a little, creates the top notches */</span>
  left: 0;
  border:solid #666;
  border-width:1px 0 0; <span style="color:#999;">/* top border only */</span>
  font-weight:normal;
}
li a b b {
  border-width:0 0 1px; <span style="color:#999;">/* bottom border only */</span>
  top: 2px; <span style="color:#999;">/* pushed down a little to create the bottom notches */</span>
}
li a b b b { <span style="color:#999;">/* i don't think three-deep tag is even necessary */</span>
  top:-1px;
  padding: 1px 6px;
  border-width: 0;
}</code></pre>

<p>To just get the notch, the third-deep <code>&lt;b&gt;</code> tag isn't needed.  I think Google Analytics included it because they wanted to add some background images with it on their buttons.  I think this effect can be achieved with one less nested <code>&lt;b&gt;</code>.</p>

<pre><code>&lt;ul&gt;
  &lt;li&gt;
    &lt;a href="/"&gt;
      <strong>&lt;b&gt;
        &lt;b&gt;</strong>
          Visitors
        <strong>&lt;/b&gt;
      &lt;/b&gt;</strong>
    &lt;/a&gt;
  &lt;/li&gt;
&lt;/ul&gt;</code></pre>

<p>In my <a href="/examples/notchedcorners/index.html">example page</a>, I left it at two deep.</p>]]>
      
   </content>
</entry>
<entry>
   <title>New CSS Off Contest April 5</title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/2008/03/new_css_off_contest_april_4.html" />
   <id>tag:www.askthecssguy.com,2008://1.46</id>
   
   <published>2008-03-21T18:46:47Z</published>
   <updated>2008-09-10T23:51:24Z</updated>
   
   <summary>I&apos;m excited about the upcoming CSS Off contest, even though I won&apos;t be judging this time around. Brad Colbow is the guest designer. I&apos;ve seen a sneak peak of the design, and it looks like it will be a fun...</summary>
   <author>
      <name></name>
      
   </author>
         <category term="popcorn" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://www.askthecssguy.com/">
      <![CDATA[<p>I'm excited about the <a href="http://cssoff.com/2008/03/20/next-contest-is-april-4-2008/">upcoming CSS Off contest</a>, even though I won't be judging this time around.  <a href="http://bradcolbow.com/">Brad Colbow</a> is the guest designer.  I've seen a sneak peak of the design, and it looks like it will be a fun challenge.  If you want to exercise your markup skills, get feedback on your approach, and possibly win a little something for your favorite charity, consider giving it a go on April 5 (Saturday).</p>

<p>It's free and open to everyone of any skill level.</p>

<p><strong>Update (23 Mar 2008):</strong> I updated the title with the correct date, April 5.</p>]]>
      
   </content>
</entry>
<entry>
   <title>I&apos;m redoing previous articles to use jQuery, you know, just for fun</title>
   <link rel="alternate" type="text/html" href="http://www.askthecssguy.com/2008/03/im_redoing_previous_articles_t_1.html" />
   <id>tag:www.askthecssguy.com,2008://1.45</id>
   
   <published>2008-03-08T04:24:55Z</published>
   <updated>2008-09-10T23:51:24Z</updated>
   
   <summary>I like using the jQuery library so much, I started converting my old article examples to use it. I thought it would be interesting to see how much less scripting I would have to write. (A little less, but not...</summary>
   <author>
      <name></name>
      
   </author>
         <category term="ringmaster" scheme="http://www.sixapart.com/ns/types#category" />
   
   
   <content type="html" xml:lang="en" xml:base="http://www.askthecssguy.com/">
      <![CDATA[<p>I like using the jQuery library so much, I started converting my old article examples to use it.  I thought it would be interesting to see how much less scripting I would have to write.  (A little less, but not much - my examples were never heavy on the scripting anyway).  I think it made some more readable, too, in that I can glance at the script code and tell what's going on.</p>

<p><a href="/examples/examplesUsingjQuery/index.html">Here's a list of what I have converted so far</a>, with a downloadable zip.</p>

<p>The obligatory disclaimer - using any library's methods is no substitute for learning JavaScript basics.  If you haven't already added JavaScript to your list of things to learn as a web designer, stop mucking around and pick up Jeremy Keith's <i>DOM Scripting</i>.</p>

<p>For a seasoned html/css person, learning jQuery is arguably much easier than learning JavaScript from scratch, since its selector syntax is based on CSS selectors.  Since I'm the CSS Guy, it is my library of choice, <em>but only when a library is needed</em>.  Some pages require so little DOM manipulation that self-written functions easily fit the bill, as well as saving some downloaded bits.</p>

<p>On a related note, someone turned my favicon article example into a <a href="http://www.babylon-design.com/site/index.php/2008/03/06/221-plugin-jquery-faviconize">jQuery plugin</a>.</p>]]>
      
   </content>
</entry>

</feed>
