<?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>Sean Landry Interaction Designer &#187; CSS</title>
	<atom:link href="http://seanlandry.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://seanlandry.com</link>
	<description>CSS zealot and user experience maniac</description>
	<lastBuildDate>Tue, 03 Jan 2012 20:04:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Designing email without images</title>
		<link>http://seanlandry.com/2011/02/16/designing-email-without-images/</link>
		<comments>http://seanlandry.com/2011/02/16/designing-email-without-images/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 15:11:46 +0000</pubDate>
		<dc:creator>slandry</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[User Experience]]></category>
		<category><![CDATA[graphic design]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://seanlandry.com/?p=247</guid>
		<description><![CDATA[At MeYou Health we&#8217;ve send out a lot of email as part of our Daily Challenge. One of the things we struggle with is design constancy from browser to browser and with images turned on and off. While our emails are far from perfect, we&#8217;re learning and always trying to improve the experience. Here are [...]]]></description>
			<content:encoded><![CDATA[<p>At <a href="http://meyouhealth.com">MeYou Health</a> we&#8217;ve send out a lot of email as part of our <a title="Daily Challenge" href="http://www.dailychallenge.com">Daily Challenge</a>. One of the things we struggle with is design constancy from browser to browser and with <strong>images turned on and off</strong>. While our emails are far from perfect, we&#8217;re learning and always trying to improve the experience. Here are a few tips we&#8217;ve discovered:</p>
<ul>
<li>Try to design without images first and only add images to enhance the design</li>
<li>Never rely on images to convey the main message of your email.</li>
<li>Use background colors to effectively design your email</li>
<li>Use old school &lt;table&gt; HTML to code your email. No body likes this but it&#8217;s your best shot at getting something that is recognizable.</li>
<li>Use table borders to create horizontal and vertical lines.</li>
<li>Be conscious of how you use your &#8220;alt&#8221; tag</li>
</ul>
<h2>Here is an example of a Hewlett-Packard email rendered in Gmail with images turned off:</h2>
<div id="attachment_250" class="wp-caption aligncenter" style="width: 201px"><a href="http://seanlandry.com/wp-content/uploads/2011/02/Screen-shot-2011-02-16-at-9.38.23-AM1.png"><img class="size-medium wp-image-250" title="Screen shot 2011-02-16 at 9.38.23 AM" src="http://seanlandry.com/wp-content/uploads/2011/02/Screen-shot-2011-02-16-at-9.38.23-AM1-191x300.png" alt="Hewlett-Packard email newsletter with images turned off" width="191" height="300" /></a><p class="wp-caption-text">Hewlett-Packard email newsletter with images turned off</p></div>
<h2>Hewlett-Packard  email with images turned on:</h2>
<div id="attachment_253" class="wp-caption aligncenter" style="width: 194px"><a href="http://seanlandry.com/wp-content/uploads/2011/02/Screen-shot-2011-02-16-at-9.43.08-AM1.png"><img class="size-medium wp-image-253" title="Screen shot 2011-02-16 at 9.43.08 AM" src="http://seanlandry.com/wp-content/uploads/2011/02/Screen-shot-2011-02-16-at-9.43.08-AM1-184x300.png" alt="HP email with images turned on" width="184" height="300" /></a><p class="wp-caption-text">HP email with images turned on:</p></div>
<p style="text-align: center;">
]]></content:encoded>
			<wfw:commentRss>http://seanlandry.com/2011/02/16/designing-email-without-images/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aligning data with a decimal point using JQuery</title>
		<link>http://seanlandry.com/2009/10/16/aligning-data-with-a-decimal-point-using-jquery/</link>
		<comments>http://seanlandry.com/2009/10/16/aligning-data-with-a-decimal-point-using-jquery/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 14:44:01 +0000</pubDate>
		<dc:creator>slandry</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Information Architecture]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://seanlandry.com/blog/2009/10/16/aligning-data-with-a-decimal-point-using-jquery/</guid>
		<description><![CDATA[Last night I received a real brain twister of a question from @ganarce on my Twitter page. He wanted to know if there was a way to align data within a table using a decimal point &#8220;.&#8221;. Seemed like a fairly routine type of formatting (invoices, data etc.). Without massaging the data ahead of time [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I received a real brain twister of a question from <a href="http://www.twitter.com/ganarce">@ganarce</a> on my <a href="http://www.twitter.com/cssanswers">Twitter page</a>. He wanted to know if there was a way to align data within a table using a decimal point &#8220;.&#8221;. Seemed like a fairly routine type of formatting (invoices, data etc.). Without massaging the data ahead of time to all have the same number of characters before or after the decimal point.</p>
<p><img src='http://seanlandry.com/blog/wp-content/uploads/2009/10/decimal.jpg' alt='Aligning data with a decimal point' /></p>
<p>I went to the W3C to for an <a href="http://www.w3.org/TR/CSS2/text.html#propdef-text-align">explanation on horizontal alignment</a>.  Ah ha! there it was. Easy enough:</p>
<p><strong>col align=&#8221;char&#8221; char=&#8221;.&#8221;</strong></p>
<p>Unfortunately there is <a href="http://reference.sitepoint.com/html/col/char">little or no support for this attribute</a> amongst the Browser community. I found <a href="http://seanlandry.com/decimal_test.html">a method using JQuery</a> that seems to work with IE, FF and Chrome.</p>
<p>Happy formatting!</p>
]]></content:encoded>
			<wfw:commentRss>http://seanlandry.com/2009/10/16/aligning-data-with-a-decimal-point-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS shorthand: borders and colors</title>
		<link>http://seanlandry.com/2009/06/15/css-shorthand-borders-and-colors/</link>
		<comments>http://seanlandry.com/2009/06/15/css-shorthand-borders-and-colors/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 17:46:40 +0000</pubDate>
		<dc:creator>slandry</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Software Design]]></category>
		<category><![CDATA[Web Standards]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://seanlandry.com/blog/2009/06/15/css-shorthand-borders-and-colors/</guid>
		<description><![CDATA[Previously I wrote about how to shorten your CSS rules with padding and margin. Here are two other ways of reducing your rules and making your stylesheets less cluttered. Border If you have a container with a border that is one pixel wide, black and is the same for all four sides you can write [...]]]></description>
			<content:encoded><![CDATA[<p>Previously I wrote about how to shorten your CSS rules with <a href="http://seanlandry.com/blog/2009/05/28/css-shorthand-padding-and-margin/">padding and margin</a>.  Here are two other ways of reducing your rules and making your stylesheets less cluttered.</p>
<h2>Border</h2>
<p>If you have a container with a border that is one pixel wide, black and is the same for all four sides you can write it like this:</p>
<blockquote><p>.myborder {<br />
	border-top: 1px solid #000000;<br />
	border-right: 1px solid #000000;<br />
	border-bottom: 1px solid #000000;<br />
	border-left: 1px solid #000000;<br />
}</p></blockquote>
<p>Or you can shorten the rule by writing it like this:</p>
<blockquote><p>.myborder {<br />
	border: solid 1px #000;<br />
	}</p></blockquote>
<p>Since all the values are shared for all four edges it is much easier to write the rule for all four at once.</p>
<h2>Color</h2>
<p>You may have also noticed that I shortened the hex value for the color from #000000 to just #000. Hexadecimal colors are written using six numbers or letters to declare the color. The 1st and 2nd are the red value. the 3rd and 4th are the green value and the 5th and 6th are the blue value. If the character is the same within these pairs then you can just write the one value and omit it&#8217;s identical twin.</p>
<p><img src='http://seanlandry.com/blog/wp-content/uploads/2009/06/color_shorthand1.jpg' alt='Color shorthand' /></p>
]]></content:encoded>
			<wfw:commentRss>http://seanlandry.com/2009/06/15/css-shorthand-borders-and-colors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS shorthand: Padding and Margin</title>
		<link>http://seanlandry.com/2009/05/28/css-shorthand-padding-and-margin/</link>
		<comments>http://seanlandry.com/2009/05/28/css-shorthand-padding-and-margin/#comments</comments>
		<pubDate>Thu, 28 May 2009 17:47:20 +0000</pubDate>
		<dc:creator>slandry</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://seanlandry.com/blog/2009/05/28/css-shorthand-padding-and-margin/</guid>
		<description><![CDATA[CSS offers the ability to shorten your code in a few instances to make it more tidy and easy to maintain. Here&#8217;s an example of how to shorten your margin and padding rules. This rule: .mydiv { padding-top: 12px; padding-right: 3px; padding-bottom: 6px; padding-left: 9px; } Is exactly the same as this rule using shorthand: [...]]]></description>
			<content:encoded><![CDATA[<p>CSS offers the ability to shorten your code in a few instances to make it more tidy and easy to maintain. Here&#8217;s an example of how to shorten your margin and padding rules.</p>
<p>This rule:</p>
<blockquote><p>.mydiv {<br />
	padding-top: 12px;<br />
	padding-right: 3px;<br />
	padding-bottom: 6px;<br />
	padding-left: 9px;<br />
}</p></blockquote>
<p>Is exactly the same as this rule using <strong>shorthand</strong>:</p>
<blockquote><p>.mydiv {<br />
	padding: 12px 3px 6px 9px;<br />
}</p></blockquote>
<p>Notice two things: First, there is no punctuation delimiter between the values <strong>just a space</strong>. Second, the <strong>order you place the values matters</strong>. Imagine a clock, starting at the top (12:00) is your first value followed by 3:00, 6:00 and 9:00. Each of these positions are how you determine where the padding/margin gets applied.</p>
<p><img src='http://seanlandry.com/blog/wp-content/uploads/2009/05/css_clock.png' alt='CSS clock' /><br />
<img src='http://seanlandry.com/blog/wp-content/uploads/2009/05/css_clock2.png' alt='CSS clock outline' /></p>
]]></content:encoded>
			<wfw:commentRss>http://seanlandry.com/2009/05/28/css-shorthand-padding-and-margin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS relative position simply explained</title>
		<link>http://seanlandry.com/2009/05/19/css-relative-position-simply-explained/</link>
		<comments>http://seanlandry.com/2009/05/19/css-relative-position-simply-explained/#comments</comments>
		<pubDate>Tue, 19 May 2009 16:37:45 +0000</pubDate>
		<dc:creator>slandry</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Standards]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://seanlandry.com/blog/2009/05/19/css-relative-position-simply-explained/</guid>
		<description><![CDATA[Relative position is one of the most understood of all the CSS positions. Once you understand how it is supposed to be rendered it can be a powerful design tool for your more complex layouts. To understand relative positioning first we need to take a look at static positioning. By default elements are positioned statically. [...]]]></description>
			<content:encoded><![CDATA[<p>Relative position is one of the most understood of all the CSS positions. Once you understand how it is supposed to be rendered it can be a powerful design tool for your more complex layouts.</p>
<p>To understand relative positioning first we need to take a look at <strong>static positioning</strong>. By default elements are positioned statically. Static elements flow normally within the document one after another based on the order of your markup. Here is a visual example of a statically positioned div with the id of &#8220;mydiv&#8221;.</p>
<p><img src='http://seanlandry.com/blog/wp-content/uploads/2009/05/static.gif' alt='Statically positioned div' /></p>
<p>Here&#8217;s the code:</p>
<blockquote><p>#mydiv {<br />
 position:static;<br />
}</p></blockquote>
<p>Static position will ignore any top, bottom, left or right declarations. Normally you would never need to write a rule like this since static is the default value unless you are trying to override another rule.</p>
<p><strong>Relative position.</strong><br />
Relative position is &#8220;relative&#8221; to the space the element would normally occupy. The element can be moved in the layout by using top, bottom, left or right.</p>
<p><img src='http://seanlandry.com/blog/wp-content/uploads/2009/05/relative.gif' alt='relative positioned div' /></p>
<p>Here&#8217;s the code:</p>
<blockquote><p>#mydiv {<br />
 position:relative;<br />
 top: 20px;<br />
 left:-75px;<br />
}</p></blockquote>
<p>This rule tells &#8220;mydiv&#8221; to move -75 pixels from it&#8217;s left position, and 20 pixels from it&#8217;s top position.</p>
<p>Notice that the area where the div was positioned statically <strong>still maintains it&#8217;s space within the layout.</strong> Hope that clears things up!</p>
]]></content:encoded>
			<wfw:commentRss>http://seanlandry.com/2009/05/19/css-relative-position-simply-explained/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My CSS Framework</title>
		<link>http://seanlandry.com/2009/05/08/my-css-framework/</link>
		<comments>http://seanlandry.com/2009/05/08/my-css-framework/#comments</comments>
		<pubDate>Fri, 08 May 2009 18:07:36 +0000</pubDate>
		<dc:creator>slandry</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Software Design]]></category>

		<guid isPermaLink="false">http://seanlandry.com/blog/2009/05/08/my-css-framework/</guid>
		<description><![CDATA[I&#8217;ve been designing a new CSS framework the last few months and thought I&#8217;d share my thoughts on how I set it up to be both useful and flexible. I&#8217;ve tried to take best practices from some of the reset.css This negates most of the CSS rules written by the default.css built into the browsers. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been designing a new CSS framework the last few months and thought I&#8217;d share my thoughts on how I set it up to be both useful and flexible. I&#8217;ve tried to take best practices from some of the</p>
<p><img src='http://seanlandry.com/blog/wp-content/uploads/2009/05/css_framework.jpg' alt='CSS Framework' /></p>
<h2>reset.css</h2>
<p>This negates most of the CSS rules written by the default.css built into the browsers. Gets everything back to a level playing field so your new rules are more predictable.</p>
<h2>layout.css</h2>
<p>All the containers, columns, navigation etc. This is the largest sheet and contains everything that doesn&#8217;t fit in any of the other sheets.</p>
<h2>colors.css</h2>
<p>This is where all your colors live. It helps with consistent usage. If you are responsible for maintaining brand this is the best place to control that effort. You can also use this sheet to define a <a href="http://dojotoolkit.org/2007/03/30/widgets-and-high-contrast-mode">high contrast</a> style as well. Just add another sheet and conditionally point to it in this one&#8217;s place.</p>
<h2>forms.css</h2>
<p>Forms are always a bear to design. This is where I keep all the form elements and different form layouts.</p>
<h2>type.css</h2>
<p>All typography is in this one. H1, H2, H3 etc. are defined here. Font-family.</p>
<h2>iehacks.css</h2>
<p>Where I make IE act like a modern browser.</p>
<h2>debug.css</h2>
<p>During development I like to tun on certain styles to help me. (ex.  div {background-color: pink;}<br />
) This helps me see all the divs on a page so I can work on floats etc. I use a JavaScript to toggle this sheet on and off.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanlandry.com/2009/05/08/my-css-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Chrome, FireFox 3, Safari or IE8</title>
		<link>http://seanlandry.com/2008/09/04/google-chrome-firefox-3-safari-or-ie8/</link>
		<comments>http://seanlandry.com/2008/09/04/google-chrome-firefox-3-safari-or-ie8/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 14:37:38 +0000</pubDate>
		<dc:creator>slandry</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Software Design]]></category>
		<category><![CDATA[Web Standards]]></category>

		<guid isPermaLink="false">http://seanlandry.com/blog/2008/09/04/google-chrome-firefox-3-safari-or-ie8/</guid>
		<description><![CDATA[I have to admit I was completely surprised when I learned Google was launching a new browser. They kept the secret under lock and key kudos to them. I&#8217;ve been test driving it for the last two days and it seems like a great new browser, it&#8217;s a little faster than FF3, Safari and IE8, [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://seanlandry.com/blog/wp-content/uploads/2008/09/browser_logos.jpg' alt='Browser logos' /><br />
I have to admit I was completely surprised when I learned Google was launching a new browser. They kept the secret under lock and key kudos to them.</p>
<p>I&#8217;ve been test driving it for the last two days and it seems like a great new browser, it&#8217;s a little faster than FF3, Safari and IE8, it&#8217;s got a decent user experience and I&#8217;ve found it to be extremely stable.</p>
<p>But more than all the new fancy new features, I&#8217;m glad it came out of the gate with excellent support for Web Standards. With FF3, Safari and IE8 the browser landscape has change dramatically over the last few months. I&#8217;m starting to see the light at the end of the IE hack tunnel. I&#8217;m starting to see what it might be like to design once and not worry about browser testing.</p>
<p>Which one is best? I&#8217;m not sure, I&#8217;ll keep banging away at all four to see if there is one clear winner but it&#8217;s obvious the biggest winner are the HTML junkie, CSS jockey and JavaScript hero.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanlandry.com/2008/09/04/google-chrome-firefox-3-safari-or-ie8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using PNG overlays to create visual effects</title>
		<link>http://seanlandry.com/2008/05/05/using-pngs-overlays-to-create-visual-effects/</link>
		<comments>http://seanlandry.com/2008/05/05/using-pngs-overlays-to-create-visual-effects/#comments</comments>
		<pubDate>Mon, 05 May 2008 16:23:19 +0000</pubDate>
		<dc:creator>slandry</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[graphic design]]></category>
		<category><![CDATA[photoshop]]></category>

		<guid isPermaLink="false">http://seanlandry.com/blog/2008/05/05/using-pngs-overlays-to-create-visual-effects/</guid>
		<description><![CDATA[A more and more users upgrade to browsers that support Alpha transparency, there are increased options for designers. A great way to get a visual effect on your images without manipulating the originals is through the use of overlays. Say you have a picture of John Wayne: Now this is great but you want it [...]]]></description>
			<content:encoded><![CDATA[<p>A more and more users upgrade to browsers that support Alpha transparency, there are increased options for designers. A great way to get a <a href="http://seanlandry.com/blog/overlay_test.html">visual effect</a> on your images without manipulating the originals is through the use of overlays.</p>
<p><strong>Say you have a picture of John Wayne:</strong></p>
<p><img src='http://seanlandry.com/blog/wp-content/uploads/2008/05/the_duke.png' alt='The Duke' /></p>
<p>Now this is great but you want it to look a bit older, weathered and aged. If you position an overlay on top of this image that contains some yellowness and some dust and scratches you can get that effect without changing the original.</p>
<p><strong>Here&#8217;s the overlay:</strong></p>
<p><img src='http://seanlandry.com/blog/wp-content/uploads/2008/05/old_overlay.png' alt='Old overlay' /></p>
<p>What you need to do now is position the overlay over the top of the original picture of the Duke. It&#8217;s z-index needs to be higher and it&#8217;s position needs to be exactly over the top of the original. <strong><a href="http://seanlandry.com/blog/overlay_test.html">See example</a></strong></p>
<p>Volia! that&#8217;s it. New style without changing the original.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanlandry.com/2008/05/05/using-pngs-overlays-to-create-visual-effects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web Standards &#8211; Chalk Talk Part Two</title>
		<link>http://seanlandry.com/2007/12/13/web-standards-chalk-talk-part-two/</link>
		<comments>http://seanlandry.com/2007/12/13/web-standards-chalk-talk-part-two/#comments</comments>
		<pubDate>Thu, 13 Dec 2007 14:01:46 +0000</pubDate>
		<dc:creator>slandry</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Standards]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://seanlandry.com/blog/?p=81</guid>
		<description><![CDATA[Yesterday I gave the second in a series of talks on web standards. The topic was a high level look at CSS. Below are the slides. &#124; View &#124; Upload your own]]></description>
			<content:encoded><![CDATA[<p>Yesterday I gave the second in a series of talks on web standards. The topic was a high level look at CSS. Below are the slides.
</p>
<div style="width:425px;text-align:left" id="__ss_201206"><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=web-standards-presentation-css-1197491444481631-4"/><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=web-standards-presentation-css-1197491444481631-4" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;"><a href="http://www.slideshare.net/?src=embed"><img src="http://static.slideshare.net/swf/logo_embd.png" style="border:0px none;margin-bottom:-5px" alt="SlideShare"/></a> | <a href="http://www.slideshare.net/slandry/web-standards-presentation-css" title="View 'Web Standards Presentation - CSS' on SlideShare">View</a> | <a href="http://www.slideshare.net/upload">Upload your own</a></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://seanlandry.com/2007/12/13/web-standards-chalk-talk-part-two/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS Specificity</title>
		<link>http://seanlandry.com/2007/12/12/css-spcificity/</link>
		<comments>http://seanlandry.com/2007/12/12/css-spcificity/#comments</comments>
		<pubDate>Wed, 12 Dec 2007 16:08:41 +0000</pubDate>
		<dc:creator>slandry</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Web Standards]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://seanlandry.com/blog/?p=80</guid>
		<description><![CDATA[If you&#8217;ve ever written CSS you&#8217;ve probably run into issues related to CSS styles which are in conflict. For instance: .blue { color: blue; } #red { color:red; } &#60;p id=&#8221;red&#8221; class=&#8221;blue&#8221;&#62;Sample Text&#60;/p&#62; The id is trying to make the text red and the class is trying to make it blue. Who wins? It all [...]]]></description>
			<content:encoded><![CDATA[<style type="text/css"> <!-- td, th { 	border: 1px solid #efefef; 	padding: 4px; }</p>
<p>th { 	background-color: #efefef; 	vertical-align: top; } --> </style>
<p>If you&#8217;ve ever written CSS you&#8217;ve probably run into issues related to CSS styles which are in conflict. For instance:</p>
<p><code>.blue { color: blue; }<br />
#red { color:red; }</code></p>
<p>&lt;p id=&#8221;red&#8221; class=&#8221;blue&#8221;&gt;Sample Text&lt;/p&gt;</p>
<p>The id is trying to make the text red and the class is trying to make it blue. Who wins? It all depends on specificity. Below is a table that explains CSS specificity.</p>
<table border="0" cellspacing="0" width="425">
<tr>
<th>Code Example</th>
<th>
<p align="center"># of inline styles</p>
</th>
<th>
<p align="center"># of ID selectors</p>
</th>
<th>
<p align="center"> # of Class selectors</p>
</th>
<th>
<p align="center"># of Element selectors</p>
</th>
</tr>
<tr>
<td>p</td>
<td>
<p align="center">0</p>
</td>
<td>
<p align="center">0</p>
</td>
<td>
<p align="center">0</p>
</td>
<td>
<p align="center">1</p>
</td>
</tr>
<tr>
<td>p.error</td>
<td>
<p align="center">0</p>
</td>
<td>
<p align="center">0</p>
</td>
<td>
<p align="center">1</p>
</td>
<td>
<p align="center">1</p>
</td>
</tr>
<tr>
<td nowrap="nowrap">#ecomm p.error</td>
<td>
<p align="center">0</p>
</td>
<td>
<p align="center">1</p>
</td>
<td>
<p align="center">1</p>
</td>
<td>
<p align="center">1</p>
</td>
</tr>
</table>
<p>With the example above the text would be rendered <strong><span style="color: red"> red</span></strong> because the ID has higher specificity than the blue class. To figure out what style takes precedence you work your way across the table. Inline style? Nope. ID? Yes. then <em>that rule</em> is more specific. If they both have IDs then you move again to the right to classes and elements.</p>
<p>The above example would render the following:</p>
<p><strong>p = 0,0,0,1</strong>  &#8211; not a very specific rule but will cascade quite nicely<br />
<strong> p.error = 0,0,1,1</strong>  &#8211; the introduction of the class negates any piling up of elements (e.x body div ul li span em )<br />
<strong> #special p.error</strong>  &#8211; the ID  is higher in specificity. Attributes which are in conflict will use the ID&#8217;s attribute values.</p>
<p>For a full explanation see the <a href="http://www.w3.org/TR/CSS21/cascade.html" title="WC3 Specificity algorithm">W3C&#8217;s specification</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://seanlandry.com/2007/12/12/css-spcificity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

