<?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>Adam Trachtenberg &#187; css</title>
	<atom:link href="http://www.trachtenberg.com/blog/tag/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.trachtenberg.com/blog</link>
	<description>Thoughts on PHP, eBay, and too many technical topics for my family's liking.</description>
	<lastBuildDate>Tue, 24 Aug 2010 21:39:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>CSS Tip: Assigning Multiple Classes to a Single Element</title>
		<link>http://www.trachtenberg.com/blog/2005/11/22/css-tip-assigning-multiple-classes-to-a-single-element/</link>
		<comments>http://www.trachtenberg.com/blog/2005/11/22/css-tip-assigning-multiple-classes-to-a-single-element/#comments</comments>
		<pubDate>Tue, 22 Nov 2005 17:42:31 +0000</pubDate>
		<dc:creator>Adam Trachtenberg</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>

		<guid isPermaLink="false">http://www.trachtenberg.com/blog/2005/11/22/css-tips-assigning-multiple-classes-to-a-single-element/</guid>
		<description><![CDATA[The 37signals team wrote up a nice trick on creating a default styling for an element using an element id and then customizing it using an element class.
Here&#8217;s one of their examples:

#Flash {
  text-align: left;
  border: 1px solid #ccc;
  font-size: 14px;
  margin: 0 7px 12px 0;
  padding: 5px 5px 5px [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://37signals.com">37signals</a> team wrote up <a href="http://37signals.com/svn/archives2/css_tip_create_a_default_with_special_cases.php">a nice trick</a> on creating a default styling for an element using an element id and then customizing it using an element class.</p>
<p>Here&#8217;s one of their examples:</p>
<pre>
#Flash {
  text-align: left;
  border: 1px solid #ccc;
  font-size: 14px;
  margin: 0 7px 12px 0;
  padding: 5px 5px 5px 30px;
}

div#Flash.good {
  border-color: #9c9;
  color: #060;
  background: url(/images/alertgood_icon.gif) #E2F9E3 left no-repeat;
}

&lt;div id=&quot;Flash&quot; class=&quot;good&quot;&gt;Oh yes, that's nice!&lt;/div&gt;
</pre>
<p>This technique is nice when you have one specific element that needs decorating. Since element ids are unique within a document, you can apply the exact formatting you need to that one section. However, you need to define an explicit CSS block &#8212; <tt>div#Flash.good</tt> in this case &#8212; each time you wish to combine styles.</p>
<p>A similar approach is assigning multiple classes to the same element:</p>
<pre>
.Flash {
  text-align: left;
  border: 1px solid #ccc;
  font-size: 14px;
  margin: 0 7px 12px 0;
  padding: 5px 5px 5px 30px;
}

.good {
  border-color: #9c9;
  color: #060;
  background: url(/images/alertgood_icon.gif) #E2F9E3 left no-repeat;
}

&lt;div class=&quot;Flash good&quot;&gt;Oh yes, that's nice!&lt;/div&gt;
</pre>
<p>Use this to compose more general styles. For example, if you want all error text to be red and bold, you could define a general error class. You can then use that style anywhere in the document with any other style without needing to update your CSS.</p>
<p>Nothing too earth shattering, but two good tools to have in your bag.</p>
<img src="http://www.trachtenberg.com/blog/?ak_action=api_record_view&id=378&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.trachtenberg.com/blog/2005/11/22/css-tip-assigning-multiple-classes-to-a-single-element/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

