<?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>Gabriel Jones &#187; css</title>
	<atom:link href="http://gabrieljones.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://gabrieljones.com</link>
	<description>Web Developer Weblog</description>
	<lastBuildDate>Tue, 30 Mar 2010 21:15:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Understanding CSS Selectors</title>
		<link>http://gabrieljones.com/understanding-css-selectors/</link>
		<comments>http://gabrieljones.com/understanding-css-selectors/#comments</comments>
		<pubDate>Thu, 23 Feb 2006 01:43:57 +0000</pubDate>
		<dc:creator>Gabriel</dc:creator>
				<category><![CDATA[css]]></category>
		<category><![CDATA[design]]></category>

		<guid isPermaLink="false">http://gabrieljones.com/?p=5</guid>
		<description><![CDATA[Class Selector
Class selectors will select any element of a given class, and apply all of its attributes.
There are two ways class selectors are applied, solitaire(generic) class selectors or element class selectors. A generic class selector will be written in a stylesheet like:
.foobar { width:100%; color:#000; }
.foosandwich { float:left; clear:left; }
Whereas your element class selector will [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Class Selector</strong></p>
<p>Class selectors will select any element of a given class, and apply all of its attributes.</p>
<p>There are two ways class selectors are applied, solitaire(generic) class selectors or element class selectors. A generic class selector will be written in a stylesheet like:</p>
<pre>.foobar { width:100%; color:#000; }
.foosandwich { float:left; clear:left; }</pre>
<p>Whereas your element class selector will look like the following</p>
<pre>p.foobar { font-size:1.4em; color:#121212; }
p.foosandwich { float:left; clear:left }
div.foo { width:80% background:#222222; }
</pre>
<p>
<b>ID Selector</b></p>
<p>ID selectors are almost identical to class selectors, with one major difference.  As previously mentioned, class selectors are applied to one or more elements on a page, whereas ID selectors are applied to <i>only one</i> element on a page.</p>
<p></p>
<p>A general rule of thumb for me is to only apply ID selectors to elements that I know will only appear once on a page, and only apply them to specific elements such as <i>h2, td, and tr</i>.  Most <i>div</i> tags will get class selector attributes, and all elements that I know or suspect will occur more than once in a single page. The only time I would use ID selector attributes on <i>div</i> tags would be on positioned elements, which generally occur only once a page.</p>
<p><b>Psuedo-Class</b></p>
<p>Psuedo-classes are used to add specific attributes/effects to specific selectors.  We commonly see this with the <i>a</i> tag.</p>
<pre>a:visited { color:#555; }
a:hover { color:#333; text-decoration:underline; }
a:active { color:#222; font-weight:bold; }
</pre>
<p>You can also apply psuedo-classes to element classes, as follows:</p>
<pre>a.title:hover { color:#00cc00; text-decoration:underline; }
a.title:visited { color:#545454; }
</pre>
<p>New to CSS2, are psuedo element selectors, <i>:lang</i>, which allows the developer to specify a language to use in a specific element, and <i>:first-child</i>, which adds style to an element that is the first child of the specified parent element, <i>:first-line</i> will style the first line of a selected element, <i>:first-letter</i> will style the first letter of the selected element, <i>:before</i> and <i>:after</i> which will add generated content before and after, respectively, to a selected element.</p>
<pre>p:first-child { text-indent:20px; }
h1:before { content: "Article "; }</pre>
<p>You can read more on psuedo-classes <a href="http://www.westciv.com/style_master/academy/css_tutorial/selectors/p_element_selectors.html">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://gabrieljones.com/understanding-css-selectors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
