<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Competent Classing</title>
	<atom:link href="http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/feed/" rel="self" type="application/rss+xml" />
	<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/</link>
	<description>Things that Eric A. Meyer, CSS expert, writes about on his personal Web site; it&#039;s largely Web standards and Web technology, but also various bits of culture, politics, personal observations, and other miscellaneous stuff</description>
	<lastBuildDate>Fri, 19 Mar 2010 00:27:46 -0400</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: OpenOn website </title>
		<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-477616</link>
		<dc:creator>OpenOn website </dc:creator>
		<pubDate>Wed, 23 Sep 2009 01:34:51 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-477616</guid>
		<description>[...] am again standing on the shoulders of giant&#8217;s regarding the markup, and in particular and keen to adopt Malarky&#8217;s conventions [...]</description>
		<content:encoded><![CDATA[<p>[...] am again standing on the shoulders of giant&#8217;s regarding the markup, and in particular and keen to adopt Malarky&#8217;s conventions [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Danny Hurlburt</title>
		<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-468260</link>
		<dc:creator>Danny Hurlburt</dc:creator>
		<pubDate>Fri, 26 Jun 2009 20:19:38 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-468260</guid>
		<description>But don&#039;t you pay a performance penalty with &lt;code&gt;div.navlinks a&lt;/code&gt; as opposed to &lt;code&gt;div.navlinks a.navlink&lt;/code&gt;?

With the first selector, anytime the browser comes across an anchor element it has to march up the DOM to see if it is a descendant of a div.navlinks. A document may very likely contain dozens or even hundreds of anchor elements that are not a descendant of a div.navlinks. Each of these anchors incurs a performance penalty even though the selector does not match.

With the second selector, anytime the browser comes across an anchor element it simply needs to check if it has the class navlink. If it doesn&#039;t, then it can dismiss the CSS selector for this anchor.

See &lt;a href=&quot;http://code.google.com/speed/page-speed/docs/rendering.html&quot; rel=&quot;nofollow&quot;&gt;http://code.google.com/speed/page-speed/docs/rendering.html&lt;/a&gt; for details on using efficient CSS selectors.</description>
		<content:encoded><![CDATA[<p>But don&#8217;t you pay a performance penalty with <code>div.navlinks a</code> as opposed to <code>div.navlinks a.navlink</code>?</p>
<p>With the first selector, anytime the browser comes across an anchor element it has to march up the DOM to see if it is a descendant of a div.navlinks. A document may very likely contain dozens or even hundreds of anchor elements that are not a descendant of a div.navlinks. Each of these anchors incurs a performance penalty even though the selector does not match.</p>
<p>With the second selector, anytime the browser comes across an anchor element it simply needs to check if it has the class navlink. If it doesn&#8217;t, then it can dismiss the CSS selector for this anchor.</p>
<p>See <a href="http://code.google.com/speed/page-speed/docs/rendering.html" rel="nofollow">http://code.google.com/speed/page-speed/docs/rendering.html</a> for details on using efficient CSS selectors.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arnaud Meuret</title>
		<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-453843</link>
		<dc:creator>Arnaud Meuret</dc:creator>
		<pubDate>Tue, 07 Apr 2009 10:16:59 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-453843</guid>
		<description>Hum, sorry to have to break the mighty 42 number of comments, but I think you should really get rid of the weird phrasings:

 &lt;b&gt;-&lt;/b&gt; &quot;space-separated words in your class values&quot; : gramatically correct but VERY misleading
 &lt;b&gt;-&lt;/b&gt; &quot;Multiple-word class names&quot; : utterly &lt;b&gt;wrong&lt;/b&gt; ! These are multiple class names.

It really looks like you did not understand the mechanism altogether.

&lt;b&gt;An element can be assigned multiple classes.&lt;/b&gt; Period. No fuzzy magic involved.

Make no mistake, I find your taking time to share your discoveries very valuable, I am doing by best to do it myself. Keep going.</description>
		<content:encoded><![CDATA[<p>Hum, sorry to have to break the mighty 42 number of comments, but I think you should really get rid of the weird phrasings:</p>
<p> <b>-</b> &#8220;space-separated words in your class values&#8221; : gramatically correct but VERY misleading<br />
 <b>-</b> &#8220;Multiple-word class names&#8221; : utterly <b>wrong</b> ! These are multiple class names.</p>
<p>It really looks like you did not understand the mechanism altogether.</p>
<p><b>An element can be assigned multiple classes.</b> Period. No fuzzy magic involved.</p>
<p>Make no mistake, I find your taking time to share your discoveries very valuable, I am doing by best to do it myself. Keep going.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Add Microformats Magic to your Site&#160;&#124;&#160;Vitamin</title>
		<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-435734</link>
		<dc:creator>Add Microformats Magic to your Site&#160;&#124;&#160;Vitamin</dc:creator>
		<pubDate>Sun, 11 Jan 2009 08:53:50 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-435734</guid>
		<description>[...] Competent Classing, by Eric Meyer [...]</description>
		<content:encoded><![CDATA[<p>[...] Competent Classing, by Eric Meyer [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SJ</title>
		<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-401857</link>
		<dc:creator>SJ</dc:creator>
		<pubDate>Wed, 20 Aug 2008 10:40:42 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-401857</guid>
		<description>for the above post 
/div class&quot;w120 h120 fleft&quot;&gt; Vs &lt;div class&quot;blockA&quot;/</description>
		<content:encoded><![CDATA[<p>for the above post<br />
/div class&#8221;w120 h120 fleft&#8221;&gt; Vs &lt;div class&#8221;blockA&#8221;/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SJ</title>
		<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-401856</link>
		<dc:creator>SJ</dc:creator>
		<pubDate>Wed, 20 Aug 2008 10:36:48 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-401856</guid>
		<description>Does multiple class pose any performance issue Vs a single class used to define a Block, 

 Vs 

where in four are in single CSS File, so the server request is 1 only.

.w120{width:120px;} 
.h120{height:120px;} 
.fleft{float:left;}

.blockA={width:120px;height:120px;float:left;}</description>
		<content:encoded><![CDATA[<p>Does multiple class pose any performance issue Vs a single class used to define a Block, </p>
<p> Vs </p>
<p>where in four are in single CSS File, so the server request is 1 only.</p>
<p>.w120{width:120px;}<br />
.h120{height:120px;}<br />
.fleft{float:left;}</p>
<p>.blockA={width:120px;height:120px;float:left;}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Meyer</title>
		<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-372865</link>
		<dc:creator>Eric Meyer</dc:creator>
		<pubDate>Wed, 07 May 2008 11:50:03 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-372865</guid>
		<description>Ah!  Thank you, &lt;a href=&quot;http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-372845&quot; rel=&quot;nofollow&quot;&gt;David&lt;/a&gt;, for clearing that up.

Of course, it&#039;s been almost four years now since the original post, so I don&#039;t recall the original project constraints---there may have been some reason that a list wasn&#039;t acceptable in those circumstances.  Doing things the list way is certainly a fine way to go; I&#039;ve done it myself many a time.  Doing the links as bar-separated text also works, of course, though it doesn&#039;t offer nearly the same level of styling flexibility.</description>
		<content:encoded><![CDATA[<p>Ah!  Thank you, <a href="http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-372845" rel="nofollow">David</a>, for clearing that up.</p>
<p>Of course, it&#8217;s been almost four years now since the original post, so I don&#8217;t recall the original project constraints&#8212;there may have been some reason that a list wasn&#8217;t acceptable in those circumstances.  Doing things the list way is certainly a fine way to go; I&#8217;ve done it myself many a time.  Doing the links as bar-separated text also works, of course, though it doesn&#8217;t offer nearly the same level of styling flexibility.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Foster</title>
		<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-372845</link>
		<dc:creator>David Foster</dc:creator>
		<pubDate>Wed, 07 May 2008 10:34:51 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-372845</guid>
		<description>I believe &lt;a href=&quot;http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-38830&quot; rel=&quot;nofollow&quot;&gt;Milos is asking&lt;/a&gt; why you use the vertical bar character in your list of links. In fact, when I&#039;d seen that, I wanted to ask the same question.

I would have done something like this:
&lt;code&gt;
&lt;ul class=&quot;navLinks&quot;&gt;
&lt;li&gt;&lt;a href=&quot;blah01&quot;&gt;Blah01&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;blah02&quot;&gt;Blah02&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;blah03&quot;&gt;Blah03&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;blah04&quot;&gt;Blah04&lt;/a&gt;&lt;/li&gt;
&lt;li class=&quot;last&quot;&gt;&lt;a href=&quot;blah05&quot;&gt;Blah05&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/code&gt;

I&#039;d then apply a border-right to all li tags except the last (accessible by the &#039;last&#039; class)</description>
		<content:encoded><![CDATA[<p>I believe <a href="http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-38830" rel="nofollow">Milos is asking</a> why you use the vertical bar character in your list of links. In fact, when I&#8217;d seen that, I wanted to ask the same question.</p>
<p>I would have done something like this:<br />
<code><br />
&lt;ul class="navLinks"&gt;<br />
&lt;li&gt;&lt;a href="blah01"&gt;Blah01&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="blah02"&gt;Blah02&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="blah03"&gt;Blah03&lt;/a&gt;&lt;/li&gt;<br />
&lt;li&gt;&lt;a href="blah04"&gt;Blah04&lt;/a&gt;&lt;/li&gt;<br />
&lt;li class="last"&gt;&lt;a href="blah05"&gt;Blah05&lt;/a&gt;&lt;/li&gt;<br />
&lt;/ul&gt;<br />
</code></p>
<p>I&#8217;d then apply a border-right to all li tags except the last (accessible by the &#8216;last&#8217; class)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric Meyer</title>
		<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-319420</link>
		<dc:creator>Eric Meyer</dc:creator>
		<pubDate>Wed, 13 Feb 2008 03:00:11 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-319420</guid>
		<description>Exactly so, &lt;a href=&quot;http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-319419&quot; rel=&quot;nofollow&quot;&gt;Evan&lt;/a&gt;!   I&#039;ve updated the post to fix that very embarrassing error.  Thanks for bringing it to my attention.

Funny that nobody else noticed or mentioned that in the 3.5 years since I wrote the post.  Well, that&#039;s why I leave comments open indefinitely!</description>
		<content:encoded><![CDATA[<p>Exactly so, <a href="http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-319419" rel="nofollow">Evan</a>!   I&#8217;ve updated the post to fix that very embarrassing error.  Thanks for bringing it to my attention.</p>
<p>Funny that nobody else noticed or mentioned that in the 3.5 years since I wrote the post.  Well, that&#8217;s why I leave comments open indefinitely!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Evan Prodromou</title>
		<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-319419</link>
		<dc:creator>Evan Prodromou</dc:creator>
		<pubDate>Wed, 13 Feb 2008 02:56:45 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-319419</guid>
		<description>You say, &lt;i&gt;That way, you can style all menus consistently via the menu class, while having the menu ID there for any &quot;Utilities&quot;-specific styling you need to do.&lt;/i&gt; I think you mean &lt;i&gt;the utilities ID&lt;/i&gt;.</description>
		<content:encoded><![CDATA[<p>You say, <i>That way, you can style all menus consistently via the menu class, while having the menu ID there for any &#8220;Utilities&#8221;-specific styling you need to do.</i> I think you mean <i>the utilities ID</i>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy Mabbett</title>
		<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-227065</link>
		<dc:creator>Andy Mabbett</dc:creator>
		<pubDate>Thu, 30 Aug 2007 10:40:27 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-227065</guid>
		<description>The example &lt;td class=&quot;subtotal&quot;&gt;&lt;span class=&quot;negative&quot;&gt; is perhaps best substituted by &lt;td class=&quot;vcard&quot;&gt;&lt;span class=&quot;fn&quot;&gt; - as used in microformats, which require classes on nested elements.</description>
		<content:encoded><![CDATA[<p>The example &lt;td class=&#8221;subtotal&#8221;&gt;&lt;span class=&#8221;negative&#8221;&gt; is perhaps best substituted by &lt;td class=&#8221;vcard&#8221;&gt;&lt;span class=&#8221;fn&#8221;&gt; &#8211; as used in microformats, which require classes on nested elements.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Randy Vogel</title>
		<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-151442</link>
		<dc:creator>Randy Vogel</dc:creator>
		<pubDate>Thu, 10 May 2007 21:57:37 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-151442</guid>
		<description>Hey now Eric!

Your example of the presentation of a negative number subtotal,
(-$422.72)
seems to overlook the fact that the use of red (via CSS) obviates the need for parentheses and minus sign.
That is, parentheses are an old-fashioned accountant&#039;s method for indicating a negative quantity (when numbers must be black), while the minus sign is the traditional mathematician&#039;s method for doing the same.

To repeat the point another way, parens OR the minus sign OR red type all indicate individually that a number is negative. It&#039;s odd to use more than one of these methods simultaneously.</description>
		<content:encoded><![CDATA[<p>Hey now Eric!</p>
<p>Your example of the presentation of a negative number subtotal,<br />
(-$422.72)<br />
seems to overlook the fact that the use of red (via CSS) obviates the need for parentheses and minus sign.<br />
That is, parentheses are an old-fashioned accountant&#8217;s method for indicating a negative quantity (when numbers must be black), while the minus sign is the traditional mathematician&#8217;s method for doing the same.</p>
<p>To repeat the point another way, parens OR the minus sign OR red type all indicate individually that a number is negative. It&#8217;s odd to use more than one of these methods simultaneously.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sven</title>
		<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-117585</link>
		<dc:creator>Sven</dc:creator>
		<pubDate>Tue, 27 Mar 2007 07:57:19 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-117585</guid>
		<description>Hi Eric,

verry good CSS coding. Thanks for the tipp.
Greeting from Germany
Sven Fischer</description>
		<content:encoded><![CDATA[<p>Hi Eric,</p>
<p>verry good CSS coding. Thanks for the tipp.<br />
Greeting from Germany<br />
Sven Fischer</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Use or abuse of class? at microformatique - a blog about microformats and &#8220;data at the edges&#8221;</title>
		<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-44767</link>
		<dc:creator>Use or abuse of class? at microformatique - a blog about microformats and &#8220;data at the edges&#8221;</dc:creator>
		<pubDate>Sat, 26 Aug 2006 10:08:15 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-44767</guid>
		<description>[...] Competent Classing, by Eric Meyer [...]</description>
		<content:encoded><![CDATA[<p>[...] Competent Classing, by Eric Meyer [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vitamin Features &#187; Add microformats magic to your site</title>
		<link>http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-44508</link>
		<dc:creator>Vitamin Features &#187; Add microformats magic to your site</dc:creator>
		<pubDate>Fri, 25 Aug 2006 14:50:52 +0000</pubDate>
		<guid isPermaLink="false">http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comment-44508</guid>
		<description>[...] Competent Classing, by Eric Meyer [...]</description>
		<content:encoded><![CDATA[<p>[...] Competent Classing, by Eric Meyer [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head profile="http://gmpg.org/xfn/1">
<title>meyerweb.com</title>
<link rel="openid.server" href="http://www.myopenid.com/server">
<link rel="openid.delegate" href="http://emeyer.myopenid.com/">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link rel="shortcut icon" href="/favicon.ico"><link rel="home" href="http://meyerweb.com/" title="Home" ><link rel="stylesheet" href="http://meyerweb.com/ui/meyerweb.css" type="text/css" media="screen, projection"><link rel="stylesheet" href="http://meyerweb.com/ui/theme.css" type="text/css" media="screen, projection" id="themeLink"><link rel="stylesheet" href="http://meyerweb.com/ui/print.css" type="text/css" media="print"><script src="http://meyerweb.com/ui/addresses.js" type="text/javascript"></script><link rel="stylesheet" href="/ui/wordpress.css" type="text/css" media="screen">
<link rel="stylesheet" href="/ui/tfe.css" type="text/css" media="screen">
<link rel="stylesheet" href="/ui/home.css" type="text/css" media="screen">
<link rel="alternate" type="application/rss+xml" title="Thoughts From Eric" href="/eric/thoughts/rss2/full" />
<link rel="alternate" type="application/rss+xml" title="Thoughts From Eric (only technical posts)" href="/eric/thoughts/category/tech/rss2/full" />
<link rel="alternate" type="application/rss+xml" title="Thoughts From Eric (only personal posts)" href="/eric/thoughts/category/personal/rss2/full" />
<link rel="alternate" type="application/rss+xml" title="Distractions" href="/eric/thoughts/recent-links/rss2" />
<link rel="alternate" type="application/rss+xml" title="Excuse of the Day" href="/feeds/excuse/rss20.xml" />
</head>
<body id="www-meyerweb-com" class="hpg">

<div id="sitemast"><h1><a href="/"><span>meyerweb</span>.com</a></h1></div><div id="search"><h4>Exploration</h4><!-- SiteSearch Google --><form method="get" action="http://www.google.com/custom" target="_top"><div><input type="hidden" name="domains" value="meyerweb.com"></input><label for="sbb" style="display: none">Submit search form</label><input type="submit" name="sa" value="Google Search" id="sbb"></input><label for="sbi" style="display: none">Enter your search terms</label><input type="text" name="q" size="31" maxlength="255" value="" id="sbi"></input><p><input type="radio" name="sitesearch" value="meyerweb.com" checked id="ss1"></input><label for="ss1" title="Search meyerweb.com">meyerweb.com</label><input type="radio" name="sitesearch" value="" id="ss0"></input><label for="ss0" title="Search the Web">Web</label></p><input type="hidden" name="client" value="pub-3772084027748653"></input><input type="hidden" name="forid" value="1"></input><input type="hidden" name="ie" value="ISO-8859-1"></input><input type="hidden" name="oe" value="ISO-8859-1"></input><input type="hidden" name="safe" value="active"></input><input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000000;GFNT:0000FF;GIMP:0000FF;FORID:1"></input><input type="hidden" name="hl" value="en"></input></div></form><!-- SiteSearch Google --><!-- <form method="get" action="http://www.google.com/custom"><div><input type="submit" name="sa" value="Search"><input type="text" name="q" size="20" maxlength="255" value=""><input type="hidden" name="sitesearch" value="meyerweb.com"></div></form><small><a href="http://www.google.com/search">Powered by Google</a></small> --></div><div id="main"><div class="skipper">Skip to: <a href="#extra">site navigation/presentation</a></div><div class="skipper">Skip to: <a href="#thoughts">Thoughts From Eric</a></div>
<div id="thoughts">


<div class="entry">
<h3><a href="http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/" rel="bookmark" title="Permanent Link: Competent Classing">Competent Classing</a></h3>
<ul class="meta">
<li class="date">Sun 18 Jul 2004</li>
<li class="time">1640</li>
<li class="cat"><a href="http://meyerweb.com/eric/thoughts/category/tech/css/" title="View all posts in CSS" rel="category tag">CSS</a></li>
<li class="cmt"><a href="http://meyerweb.com/eric/thoughts/2004/07/18/competent-classing/#comments">45 responses</a></li>
<li></li><li></li></ul>

<div class="text">
<p>
At last week&#8217;s Web Design Meetup, a couple of people showed me their current projects.  As is my wont, I glanced over the visual design and then started digging into the document markup.  In the course of the resulting conversation, I pointed out some ways to tighten up the markup.  I&#8217;ll repeat them here for those who are curious.  All of them relate to using classes and IDs efficiently.
</p>
<p>
The first recommendation I had was to use classes and IDs in conjunction.  Not everyone is aware that an element can carry both a class and an ID.  Well, they can.  So it&#8217;s no problem to have markup like this:
</p>
<pre>
&lt;div id="utilities" class="menu"&gt;
</pre>
<p>
That way, you can style all menus consistently via the <code>menu</code> class, while having the <code>utilities</code> ID there for any &#8216;Utilities&#8217;-specific styling you need to do.  This has always been possible, and it&#8217;s supported by multiple browsers.  You don&#8217;t see it often, I admit, but then it&#8217;s not often needed.
</p>
<p>
The second recommendation was to use space-separated words in your class values.  This is thoroughly legitimate, and can make things a lot more compact.  So you might have something like:
</p>
<pre>
&lt;td class="subtotal negative"&gt;(-$422.72)&lt;/td&gt;
</pre>
<p>
You can then have one rule that styles all <code>subtotal</code>s, and another than styles any <code>negative</code> number.  For example:
</p>
<pre>
.subtotal {font-weight: bold;}
.negative {color: red;}
</pre>
<p>
By using these kinds of class values, you can avoid having to construct one class for <code>subtotal</code>, and another for <code>subtotal-negative</code>.  If you&#8217;re doing that sort of thing, I can tell you right now that your CSS is larger and more complicated than it needs to be.  Multiple-word class names also free you from having to do things like throw in extra <code>span</code>s or other elements just to add more information, like so:
</p>
<pre>
&lt;td class="subtotal"&gt;&lt;span class="negative"&gt;(-$422.72)&lt;/span&gt;&lt;/td&gt;
</pre>
<p>
That kind of structure is almost never needed, except in extremely rare cases where you must have an inline element on which you hang some presentational styles that can&#8217;t be applied to the table cell.  I can&#8217;t even think of a concrete example right now, but I&#8217;m sure there is one.  In which case, I&#8217;d say do this instead:
</p>
<pre>
&lt;td class="subtotal negative"&gt;&lt;span&gt;(-$422.72)&lt;/span&gt;&lt;/td&gt;
</pre>
<p>
But, as I say, the odds of your having to do that are very very low.
</p>
<p>
All this leads to a third recommendation that came to mind as I looked over the markup.  Remember to use document structure to your advantage, and not to class everything in sight.  I can&#8217;t tell you how many times I&#8217;ve seen this kind of markup:
</p>
<pre>
&lt;div class="navlinks"&gt;
&lt;a href="blah01" class="navlink"&gt;Blah01&lt;/a&gt; |
&lt;a href="blah02" class="navlink"&gt;Blah02&lt;/a&gt; |
&lt;a href="blah03" class="navlink"&gt;Blah03&lt;/a&gt; |
&lt;a href="blah04" class="navlink"&gt;Blah04&lt;/a&gt; |
&lt;a href="blah05" class="navlink"&gt;Blah05&lt;/a&gt;
&lt;/div&gt;
</pre>
<p>
Out of the six classes that appear in that markup fragment, five are completely useless and simply bloat the page weight.  Here&#8217;s a much more efficient way to structure the markup:
</p>
<pre>
&lt;div class="navlinks"&gt;
&lt;a href="blah01"&gt;Blah01&lt;/a&gt; |
&lt;a href="blah02"&gt;Blah02&lt;/a&gt; |
&lt;a href="blah03"&gt;Blah03&lt;/a&gt; |
&lt;a href="blah04"&gt;Blah04&lt;/a&gt; |
&lt;a href="blah05"&gt;Blah05&lt;/a&gt;
&lt;/div&gt;
</pre>
<p>
Now all you do to style the links is write a rule that uses the selector <code>div.navlinks a</code> instead of one that uses <code>a.navlink</code>.  In addition to making the HTML weight smaller, it also makes the document cleaner and a whole lot easier to read.  Your users don&#8217;t really care about that, of course, but I bet <em>you</em> will, if you ever have to go in and adjust either the markup or the content.
</p>
<p>
So there you go.  Hopefully it was of some help to you.
</p></div>

</div>

</div>
<p style="font-size: 90%; text-align: right; margin-top: 0.5em; padding-top: 0;">(If you care, there's even an <a href="/eric/thoughts/page/2/">archive of previous thoughts</a>...)</p>

</div><div id="extra"><div class="panel" id="archipelago"><h4>Identity Archipelago</h4><ul><li><a href="http://flickr.com/photos/meyerweb/" rel="me">Flickr</a></li><li><a href="http://twitter.com/meyerweb/" rel="me">Twitter</a></li><li><a href="http://dopplr.com/traveller/meyerweb">Dopplr</a></li><li><a href="http://www.linkedin.com/in/meyerweb" rel="me">LinkedIn</a></li><li><a href="http://technorati.com/profile/emeyer" rel="me">Technorati</a></li></ul></div><div class="panel" id="pointers"><h4>Projects Elsewhere</h4><ul><li><a href="http://aneventapart.com/">An Event Apart</a></li><li><a href="http://complexspiral.com/">Complex Spiral Consulting</a></li><li><a href="http://www.webassist.com/go/css/emeyer/">CSS Sculptor</a></li><li><a href="http://css-discuss.org/">css-discuss</a></li><li><a href="http://microformats.org/">Microformats</a></li><li><a href="http://s5project.org/">S5</a></li></ul></div><div class="panel" id="tour"><ul><li><a href="http://fray.com/issue3/"><img src="http://fray.com/images/i3c.gif" alt="Fray Contributor (Issue 3: Sex &amp; Death)" /></a></li><!-- <li><a href="http://www.webassist.com/go/css/emeyer/"><img src="/pix/CS_ad_180x109.jpg" alt="CSS Sculptor for Dreamweaver" style="max-width: 100%;" /></a></li> --></ul></div><div class="panel">
<h4>Recently Tweeted</h4>
<p class="more"><a href="http://twitter.com/meyerweb">see more</a></p>
<p>Now that Congress has passed health insurance reform, is there any sign they're thinking about reforming health care as well? <small>&#8211;tweeted 6 hours, 51 minutes ago</small></p>
</div><div id="sideblog" class="panel">
<h4>Distractions</h4>
<p class="more">
<a href="/eric/thoughts/recent-links/">archive</a>
</p>
<ul>
<li><a href="http://tweetagewasteland.com/2010/03/my-head-is-in-the-cloud/" title="March 18 | &#8220;I sense that my addiction to the realtime stream is only making room for the consumption of a faster stream.&#8221;">My Head is in the Cloud</a> <small>[via <a href="http://daringfireball.net/">John</a>]</small></li>
<li><a href="http://8bitnyc.com/" title="March 17 | All of a sudden I want to establish a mission in Central Park and negotiate with the natives for gold and food.">8-Bit NYC</a></li>
<li><a href="http://www.youtube.com/watch?v=nFicqklGuB0&amp;feature=player_embedded" title="March 12 | Wry comment expressing my appreciation of the creative derivativeness of this video and its uncanny accuracy in mocking common tropes.">Academy Award Winning Movie Trailer</a></li>
<li><a href="http://www.youtube.com/watch?v=414TmP12WAU" title="March 9 | &#8220;Apple juice&#8230; for half price!&#8221;  More like twice PRICELESS.  (Note: If you&#8217;re at work, don your headphones.)">Happy in Paraguay</a> <small>[via <a href="http://unstoppablerobotninja.com/">Ethan</a>]</small></li>
<li><a href="http://www.youtube.com/watch?v=9V5ubAOeOBk&amp;feature=player_embedded" title="February 10 | This is approximately the best thing ever.">U900 -Walk Don&#8217;t Run (Isogabamaware)</a></li>
<li><a href="http://www.456bereastreet.com/archive/201002/sifr_default_css_hides_content_from_at_least_one_screen_reader/?utm_source=feedburner&amp;utm_medium=feed&amp;utm_campaign=Feed%3A 456bereastreet %28456 Berea Street%29" title="February 8 | -9999px comes through again, but I really wish we were beyond that kind of thing.">sIFR default CSS hides content from at least one screen reader</a></li>
<li><a href="http://www.macosxhints.com/article.php?story=20100117064356428" title="February 8 | Storing this for future use.">Take a picture with the iSight camera when a folder is opened</a></li>
<li><a href="http://mingle2.com/blog/view/web-developer-mind" title="February 4 | Mostly valid.  (SEE WHAT I DID THERE?)">The Mind of a Web Developer: An Illustrated Diagram</a></li>
<li><a href="http://www.theonion.com/content/news/science_channel_refuses_to_dumb" title="January 28 | &#8220;Punkin Chunkin, for Christ&#8217;s sake&#8230; What more do you people want?&#8221;">Science Channel Refuses To Dumb Down Science Any Further</a></li>
<li><a href="http://www.mailchimp.com/blog/project-omnivore-declassified/" title="January 27 | Sounds like quite a feat.  But I wonder how we&#8217;d feel if Microsoft or Google announced the same kind of thing on their e-mail services.">MailChimp&#8217;s Project Omnivore: Declassified</a></li>
<li><a href="http://www.politifact.com/truth-o-meter/statements/2010/jan/25/carolyn-maloney/congresswoman-says-democratic-presidents-create-mo/" title="January 26 | &#8220;Obviously, luck matters a lot, but when there is a consistent pattern over more than 60 years, it starts to look like more than just luck.&#8221;">Congresswoman says Democratic presidents create more private-sector jobs</a></li>
<li><a href="http://www.ted.com/talks/taylor_mali_what_teachers_make.html" title="January 25 | Truth.">Taylor Mali: What teachers make</a></li>
<li><a href="http://notebook.johnmartz.com/how-websites-work?c=1" title="January 22 | At last, the truth is out and I can stop pretending:  beatific monkeys are what makes it all go.">How websites work</a></li>
</ul>
</div>
<div class="panel" id="advisory">
<div class="guarded">
<a href="http://blogadvisorysystem.com/"><img src="/pix/bas/guarded.png" alt="Blog Advisory System Alert Level: Guarded"></a>
</div>
</div>

<div class="panel" id="excuse">
<h4>The <a href="/feeds/excuse/">excuse of the day</a> is</h4>
<p>Republicans</p>
</div>

<div class="panel" id="extras">
<h4>Extras</h4>
<ul>
<li><a href="/feeds/">Feeds</a> &#8226;</li>
<li><a href="/eric/faq.html">FAQ</a> &#8226;</li>
<li><a href="/family.html">Family</a></li>
</ul>
</div>

</div>

<div id="navigate">
<h4>Navigation</h4>
<ul id="navlinks">
<li id="archLink"><a href="/eric/thoughts/">Archives</a></li>
<li id="cssLink"><a href="/eric/css/">CSS</a></li>
<li id="toolsLink"><a href="/eric/tools/">Toolbox</a></li>
<li id="writeLink"><a href="/eric/writing.html">Writing</a></li>
<li id="speakLink"><a href="/eric/talks/">Speaking</a></li>
<li id="otherLink"><a href="/other/">Leftovers</a></li>
<li id="aboutsite"><a href="/ui/about.html">About this site</a></li>
</ul>
</div>

<div id="footer">
<p class="sosumi">All contents of this site, unless otherwise noted, are &copy;1995-2008 <strong>Eric A. and Kathryn S. Meyer</strong>.  All Rights Reserved.</p>
<p>"<a href="/eric/thoughts/">Thoughts From Eric</a>" is powered by the &uuml;bercool <a href="http://wordpress.org/">WordPress</a></p>
</div>
</body>
</html>
