<?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>James Padolsey&#187; CSS category &#8211; James Padolsey</title>
	<atom:link href="http://james.padolsey.com/category/css/feed/" rel="self" type="application/rss+xml" />
	<link>http://james.padolsey.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 21 Aug 2010 04:38:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>&#8220;Grayscaling&#8221; in non-IE browsers</title>
		<link>http://james.padolsey.com/javascript/grayscaling-in-non-ie-browsers/</link>
		<comments>http://james.padolsey.com/javascript/grayscaling-in-non-ie-browsers/#comments</comments>
		<pubDate>Mon, 11 May 2009 09:03:41 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Experiment]]></category>
		<category><![CDATA[IE]]></category>

		<guid isPermaLink="false">http://james.padolsey.com/?p=807</guid>
		<description><![CDATA[This started out as a little experiment and eventually turned into quite an endeavor. The task was simple enough; to emulate Internet Explorer&#8217;s &#8216;<a href="http://msdn.microsoft.com/en-us/library/ms532889(VS.85).aspx">grayscale</a>&#8216; filter in all non-IE browsers. The solution, much to my initial surprise, is not as tricky as you would think.

The&#8230;]]></description>
			<content:encoded><![CDATA[<p>This started out as a little experiment and eventually turned into quite an endeavor. The task was simple enough; to emulate Internet Explorer&#8217;s &#8216;<a href="http://msdn.microsoft.com/en-us/library/ms532889(VS.85).aspx">grayscale</a>&#8216; filter in all non-IE browsers. The solution, much to my initial surprise, is not as tricky as you would think.</p>

<p>The &#8216;<a href="http://msdn.microsoft.com/en-us/library/ms532889(VS.85).aspx">grayscale</a>&#8216; filter in IE can be applied to any element and visually transforms the element itself into grayscale. You can apply the filter using one line of messy proprietary CSS:</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">elem.<span class="me1">style</span>.<span class="me1">filter</span> <span class="sy0">=</span> <span class="st0">'progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)'</span><span class="sy0">;</span></pre></div></div>




<p>This can also be defined in your StyleSheet:</p>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">elem <span class="br0">&#123;</span>
    filter<span class="sy0">:</span> progid<span class="re2">:DXImageTransform</span><span class="re1">.Microsoft</span>.BasicImage<span class="br0">&#40;</span>grayscale<span class="sy0">=</span><span class="nu0">1</span><span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="coMULTI">/* Element must &quot;hasLayout&quot;! */</span>
    zoom<span class="sy0">:</span> <span class="nu0">1</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>




<p>As shown, getting this to work in IE is a piece of cake; other browsers, however, require much more attention!</p>

<p>There are two things to consider; images and everything else. &#8220;Everything else&#8221; is quite simple; loop through all elements within the document and look for colour properties such as &#8216;backgroundColor&#8217; and &#8216;color&#8217;, then convert their RGB values to grayscale. There are a few ways of doing this; note that we&#8217;re not talking about desaturating a photo; &#8220;grayscaling&#8221; is slightly different (as I understand it):</p>

<span id="more-807"></span>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span class="co1">// Desaturate:</span>
<span class="kw2">function</span> RGBtoDesat<span class="br0">&#40;</span>r<span class="sy0">,</span>g<span class="sy0">,</span>b<span class="br0">&#41;</span> <span class="br0">&#123;</span>
    <span class="kw2">var</span> average <span class="sy0">=</span> <span class="br0">&#40;</span>r <span class="sy0">+</span> g <span class="sy0">+</span> b<span class="br0">&#41;</span> <span class="sy0">/</span> <span class="nu0">3</span><span class="sy0">;</span>
    <span class="kw1">return</span> <span class="br0">&#123;</span>
        r<span class="sy0">:</span> average<span class="sy0">,</span>
        g<span class="sy0">:</span> average<span class="sy0">,</span>
        b<span class="sy0">:</span> average
    <span class="br0">&#125;</span><span class="sy0">;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="co1">// Grayscale:</span>
<span class="kw2">function</span> RGBtoGrayscale<span class="br0">&#40;</span>r<span class="sy0">,</span>g<span class="sy0">,</span>b<span class="br0">&#41;</span> <span class="br0">&#123;</span>
    <span class="kw2">var</span> mono <span class="sy0">=</span> parseInt<span class="br0">&#40;</span> <span class="br0">&#40;</span><span class="nu0">0.2125</span> <span class="sy0">*</span> r<span class="br0">&#41;</span> <span class="sy0">+</span> <span class="br0">&#40;</span><span class="nu0">0.7154</span> <span class="sy0">*</span> g<span class="br0">&#41;</span> <span class="sy0">+</span> <span class="br0">&#40;</span><span class="nu0">0.0721</span> <span class="sy0">*</span> b<span class="br0">&#41;</span><span class="sy0">,</span> <span class="nu0">10</span> <span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="kw1">return</span> <span class="br0">&#123;</span>
        r<span class="sy0">:</span> mono<span class="sy0">,</span>
        g<span class="sy0">:</span> mono<span class="sy0">,</span>
        b<span class="sy0">:</span> mono
    <span class="br0">&#125;</span><span class="sy0">;</span>
<span class="br0">&#125;</span></pre></div></div>




<p>So, each element with a colour property has it converted to grayscale; the original colour is stored somewhere for resetting purposes.</p>

<p>Whether our image can be converted to grayscale depends on two things; the browser in question must support the HTML5 canvas element and its &#8216;getImageData&#8217; method and the image must be hosted on the same domain; externally hosted images cannot be passed into &#8216;getImageData&#8217; regardless of whether it&#8217;s supported. Google Chrome and Safari (&lt;4) don&#8217;t support &#8216;getImageData&#8217; so we&#8217;re stuck there, but, on other browsers that support the canvas element &#8220;grayscaling&#8221; images can be achieved!</p>

<p>The only way to do this is to &#8220;manually&#8221; traverse all pixels of the image in question and apply the same &#8216;RGBtoGrayscale&#8217; function as we did for the CSS colour properties. This can really eat up the browser; even speedy JavaScript engines can suffer considerably with large images.</p>

<p>For the reason mentioned above it makes sense to add a &#8216;prepare&#8217; function to run before anything actually needs to be &#8220;grayscaled&#8221; &#8211; this function can use the classic zero-timeout recursion technique so as not to lock up the browser. If only small images need to be converted then you can avoid using &#8216;prepare&#8217; and go straight ahead with the brute-force conversion.</p>

<h2>Why, oh why?</h2>

<p>You may wonder what the point is in &#8220;grayscaling&#8221; anything&#8230; Well, for one; eliminating colour detracts focus from the user therefore leaving their attention open for other focus-grabbing items on your website; e.g. a lightbox. Forum software such as vBulletin makes it so that the page goes entirely grayscale when you click logout; this brings up a confirm box which is quickly and easily identifiable since it&#8217;s the one of the only things with colour left on the screen.</p>

<p>The real reason behind this whole &#8220;grayscaling&#8221; obsession is that I was curious about whether it&#8217;d be possible to achieve; I knew about the filter in IE and wondered if other browsers could be made to emulate this handy effect. I know the effect itself might be considered out-of-date but I really don&#8217;t care; I was only interested in getting it to work.</p>

<h2>Demo</h2>

<p>For those blood-thirsty demo hunters lurking around I&#8217;ve created a demo page which shows the functionality as described in this post. Remember, it won&#8217;t work properly in Safari (&lt;4) or Chrome (and probably some old version (pre v.2) of FF); also remember it&#8217;s just an experiment!</p>

<p class="video"><strong>The DEMO: <a href="http://james.padolsey.com/demos/grayscale/">/demos/grayscale/</a></strong><br/><br/><img src="http://james.padolsey.com/wp-content/uploads/robotscompare_grayscale.png" width="500" height="391" /></p>

<h2>Usage</h2>

<p>To &#8220;grayscale&#8221; an element you need to call <code>grayscale()</code> with that element passed as a reference, e.g.</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span class="kw2">var</span> el <span class="sy0">=</span> document.<span class="me1">getElementById</span><span class="br0">&#40;</span> <span class="st0">'myEl'</span> <span class="br0">&#41;</span><span class="sy0">;</span>
grayscale<span class="br0">&#40;</span> el <span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// Alternatively, pass a DOM collection</span>
<span class="co1">// (all elements will get &quot;grayscaled&quot;)</span>
grayscale<span class="br0">&#40;</span> document.<span class="me1">getElementsByTagName</span><span class="br0">&#40;</span><span class="st0">'div'</span><span class="br0">&#41;</span> <span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="co1">// Even works with jQuery collections:</span>
grayscale<span class="br0">&#40;</span> $<span class="br0">&#40;</span><span class="st0">'div'</span><span class="br0">&#41;</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>




<p>To reset an element (back to its original colourful state) you must call <code>grayscale.reset()</code> and pass whatever elements you want reset:</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">grayscale.<span class="me1">reset</span><span class="br0">&#40;</span> el <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co1">// reset() also accepts DOM/jQuery collections</span>
grayscale.<span class="me1">reset</span><span class="br0">&#40;</span> $<span class="br0">&#40;</span><span class="st0">'div'</span><span class="br0">&#41;</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>




<p>The &#8216;prepare&#8217; function, as discussed earlier, should be called when there&#8217;s a large image to process or even if there are several smaller images. Be aware that larger images will take quite a while to process (just a 300&#215;300 PNG takes about 3 seconds in &#8216;prepare&#8217; mode). </p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">grayscale.<span class="me1">prepare</span><span class="br0">&#40;</span> document.<span class="me1">getElementById</span><span class="br0">&#40;</span><span class="st0">'myEl'</span><span class="br0">&#41;</span> <span class="br0">&#41;</span><span class="sy0">;</span>
<span class="co1">// Also accepts DOM/jQuery collections</span>
grayscale.<span class="me1">prepare</span><span class="br0">&#40;</span> $<span class="br0">&#40;</span><span class="st0">'.gall_img'</span><span class="br0">&#41;</span> <span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>


]]></content:encoded>
			<wfw:commentRss>http://james.padolsey.com/javascript/grayscaling-in-non-ie-browsers/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Fixing &#8220;:focus&#8221; in Internet Explorer</title>
		<link>http://james.padolsey.com/javascript/fixing-focus-in-internet-explorer/</link>
		<comments>http://james.padolsey.com/javascript/fixing-focus-in-internet-explorer/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 16:48:24 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://james.padolsey.com/?p=760</guid>
		<description><![CDATA[Internet Explorer doesn't support ':focus' within CSS selectors, a dynamic pseudo class implemented in CSS2. This jQuery plugin fixes that ]]></description>
			<content:encoded><![CDATA[<p>Currently, Internet Explorer doesn&#8217;t support &#8216;<a href="http://reference.sitepoint.com/css/pseudoclass-focus">:focus</a>&#8216; within CSS selectors, a <a href="http://www.w3.org/TR/CSS2/selector.html#dynamic-pseudo-classes">dynamic pseudo-class</a> implemented in CSS2. The Anchor and most form elements (<code>input</code>, <code>textarea</code> etc.) support this psuedo class. It&#8217;s normally used to make it obvious to the user where &#8216;focus&#8217; currently is. This can be especially useful for users who browse without a mouse (just using a keyboard).</p>

<p>It&#8217;s easy enough to fix with JavaScript; you can just apply the styles on the &#8216;focus&#8217; and &#8216;blur&#8217; events. The problem with this is that you&#8217;ll also be affecting browsers that already have support for &#8216;:focus&#8217;. So you need a reliable way (no browser sniffing) of determining whether or not it&#8217;s supported. Also, manually adding these event handlers where needed is a bit of a pain&#8230; something we could certainly do without.</p>

<p>&#8216;pseudoFocus&#8217; is a jQuery plugin that fixes the &#8216;focus&#8217; pseudo class in all browsers that don&#8217;t support it. It doesn&#8217;t use browser sniffing to determine support, but instead performs a check to determine whether the browser in question supports the specific feature:</p>


<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span class="kw2">var</span> focusIsSupported <span class="sy0">=</span> <span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span>
&nbsp;
    <span class="co1">// Create an anchor + some styles including ':focus'.</span>
    <span class="co1">// Focus the anchor, test if style was applied,</span>
    <span class="co1">// if it was then we know ':focus' is supported.</span>
&nbsp;
    <span class="kw2">var</span> ud <span class="sy0">=</span> <span class="st0">'t'</span> <span class="sy0">+</span> <span class="sy0">+</span><span class="kw2">new</span> Date<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">,</span>
        anchor <span class="sy0">=</span> $<span class="br0">&#40;</span><span class="st0">'&lt;a id=&quot;'</span> <span class="sy0">+</span> ud <span class="sy0">+</span> <span class="st0">'&quot; href=&quot;#&quot;/&gt;'</span><span class="br0">&#41;</span>.<span class="me1">css</span><span class="br0">&#40;</span><span class="br0">&#123;</span>top<span class="sy0">:</span><span class="st0">'-999px'</span><span class="sy0">,</span>position<span class="sy0">:</span><span class="st0">'absolute'</span><span class="br0">&#125;</span><span class="br0">&#41;</span>.<span class="me1">appendTo</span><span class="br0">&#40;</span><span class="st0">'body'</span><span class="br0">&#41;</span><span class="sy0">,</span>
        style <span class="sy0">=</span> $<span class="br0">&#40;</span><span class="st0">'&lt;style&gt;#'</span><span class="sy0">+</span>ud<span class="sy0">+</span><span class="st0">'{font-size:10px;}#'</span><span class="sy0">+</span>ud<span class="sy0">+</span><span class="st0">':focus{font-size:1px !important;}&lt;/style&gt;'</span><span class="br0">&#41;</span>.<span class="me1">appendTo</span><span class="br0">&#40;</span><span class="st0">'head'</span><span class="br0">&#41;</span><span class="sy0">,</span>
        supported <span class="sy0">=</span> anchor.<span class="kw3">focus</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">css</span><span class="br0">&#40;</span><span class="st0">'fontSize'</span><span class="br0">&#41;</span> <span class="sy0">!==</span> <span class="st0">'10px'</span><span class="sy0">;</span>
    anchor.<span class="me1">add</span><span class="br0">&#40;</span>style<span class="br0">&#41;</span>.<span class="me1">remove</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="kw1">return</span> supported<span class="sy0">;</span>
&nbsp;
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>




<p>Once it has performed the check it will then run through all the StyleSheets looking for selectors with the &#8216;focus&#8217; psuedo class (or &#8216;:unknown&#8217; in IE6) and then automatically attaches the &#8216;focus&#8217; and &#8216;blur&#8217; handlers to whatever elements are targeted by each of those selectors.</p>

<p>Note that this will only work if your rules are defined in an external StyleSheet, the plugin won&#8217;t check for styles within <code>&lt;style/&gt;</code> tags.</p>

<p>A quick demo is available here: <a href="http://james.padolsey.com/demos/plugins/jQuery/pseudofocus/">/demos/plugins/jQuery/pseudofocus/</a>, and you can download the entire plugin here: <a href="http://james.padolsey.com/demos/plugins/jQuery/pseudofocus/pseudofocus.js">/demos/plugins/jQuery/pseudofocus/pseudofocus.js</a></p>

<p>Another note: If you need to support more than just anchors, buttons, inputs and textareas then you can add to the <code>isAcceptable</code> variable within the plugin. It&#8217;s a comma separated list that defines &#8220;focusable&#8221; elements. The reason for this list is to ensure that all selectors containing &#8216;:focus&#8217; work, even including the following:</p>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span class="re0">#nav</span> a<span class="re2">:focus </span>span<span class="re1">.whatever</span> <span class="br0">&#123;</span><span class="br0">&#125;</span>
<span class="re0">#nav</span> a<span class="re2">:focus </span><span class="br0">&#123;</span><span class="br0">&#125;</span>
<span class="re0">#go-button</span><span class="re2">:focus </span>img <span class="br0">&#123;</span><span class="br0">&#125;</span></pre></div></div>




<p>Be aware that you can&#8217;t add any element to this list and expect it to work; the list is only there to provide a primitive check &#8211; elements that have no &#8216;focus&#8217;/'blur&#8217; events will not be effected.</p>]]></content:encoded>
			<wfw:commentRss>http://james.padolsey.com/javascript/fixing-focus-in-internet-explorer/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t use &#8220;!important&#8221;</title>
		<link>http://james.padolsey.com/usability/dont-use-important/</link>
		<comments>http://james.padolsey.com/usability/dont-use-important/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 08:37:47 +0000</pubDate>
		<dc:creator>James</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[Specificity]]></category>

		<guid isPermaLink="false">http://james.padolsey.com/?p=676</guid>
		<description><![CDATA[In CSS, the &#8220;!important&#8221; suffix was originally intended to provide a method of overriding author stylesheets. Users could define their own &#8220;user stylesheets&#8221; and could use this suffix to give their rules precedence over the author&#8217;s (website creator&#8217;s) styles.

Unfortunately, and quite predictably, its usage&#8230;]]></description>
			<content:encoded><![CDATA[<p>In CSS, the &#8220;!important&#8221; suffix was originally intended to provide a method of overriding author stylesheets. Users could define their own &#8220;user stylesheets&#8221; and could use this suffix to give their rules precedence over the author&#8217;s (website creator&#8217;s) styles.</p>

<p>Unfortunately, and quite predictably, its usage has spread massively, but not in the right direction. Nowadays, it&#8217;s used to counteract the pain of having to deal with CSS specificity, otherwise known as the set of rules which dictate that &#8220;div h1 a&#8221; is more specific selector than &#8220;div a&#8221;. Most people that use CSS on a daily basis don&#8217;t know enough about CSS specificity to solve their problems without using the &#8220;!important&#8221; suffix.</p>

<p>For reference, &#8220;specificity&#8221; is the name given to signify the precedence of a particular CSS selector. Here&#8217;s a quick rundown:</p>


<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span class="sy0">*</span>             <span class="br0">&#123;</span><span class="br0">&#125;</span>  <span class="coMULTI">/* a=0 b=0 c=0 -&gt; specificity =   0 */</span>
LI            <span class="br0">&#123;</span><span class="br0">&#125;</span>  <span class="coMULTI">/* a=0 b=0 c=1 -&gt; specificity =   1 */</span>
UL LI         <span class="br0">&#123;</span><span class="br0">&#125;</span>  <span class="coMULTI">/* a=0 b=0 c=2 -&gt; specificity =   2 */</span>
UL OL<span class="sy0">+</span>LI      <span class="br0">&#123;</span><span class="br0">&#125;</span>  <span class="coMULTI">/* a=0 b=0 c=3 -&gt; specificity =   3 */</span>
H1 <span class="sy0">+</span> <span class="sy0">*</span><span class="br0">&#91;</span>REL<span class="sy0">=</span>up<span class="br0">&#93;</span><span class="br0">&#123;</span><span class="br0">&#125;</span>  <span class="coMULTI">/* a=0 b=1 c=1 -&gt; specificity =  11 */</span>
UL OL LI<span class="re1">.red</span>  <span class="br0">&#123;</span><span class="br0">&#125;</span>  <span class="coMULTI">/* a=0 b=1 c=3 -&gt; specificity =  13 */</span> 
LI<span class="re1">.red</span><span class="re1">.level</span>  <span class="br0">&#123;</span><span class="br0">&#125;</span>  <span class="coMULTI">/* a=0 b=2 c=1 -&gt; specificity =  21 */</span>
<span class="re0">#x34y</span>         <span class="br0">&#123;</span><span class="br0">&#125;</span>  <span class="coMULTI">/* a=1 b=0 c=0 -&gt; specificity = 100 */</span>
&nbsp;
<span class="coMULTI">/* Source: http://www.w3.org/TR/CSS2/cascade.html */</span></pre></div></div>




<p>The specificity is calculated as follows:</p>

<ul>
    <li>count the number of ID attributes in the selector (= a)</li>
    <li>count the number of other attributes and pseudo-classes in the selector (= b)</li>
    <li>count the number of element names in the selector (= c)</li>
    <li>ignore pseudo-elements. </li>
</ul>

<p>(read more about it: <a href="http://www.w3.org/TR/CSS2/cascade.html#important-rules">http://www.w3.org/TR/CSS2/cascade.html#important-rules</a>)</p>
    


<p>The power of CSS and its cascading nature, in my opinion, is only fully appreciated when one understands specificity. A lack of understanding only leads to bad practices, such as using the &#8220;!important&#8221; suffix. Of course, it&#8217;s not always a bad idea, sometimes it&#8217;s necessary; for example, the Google toolbar in browsers always insists on colouring certain input fields yellow to signify that an &#8216;autocomplete&#8217; feature is available. To be blunt, this can make your design look crap! The only way to counteract this is to define an &#8220;!important&#8221; style, i.e. the only thing more specific than inline styles.</p>

<p>Apart from a few edge cases its use is, in my opinion, unfounded and mostly unnecessary. Not to mention the fact of how annoying it is for a user when they want to apply their own styles or enhancements; you better have a damn good reason for relinquishing such a rudimentary level of control!</p>

<p>The only thing that can override an &#8220;!important&#8221; rule is <em>another</em> one, which must be specified lower down and its selector must have the same (or a higher) level of specificity. You can also specify &#8220;!important&#8221; styles inline. Another method would be to remove the rule entirely, this can be achieved with JavaScript, by accessing and manually removing the rule in question: <a href="http://dev.opera.com/articles/view/dynamic-style-css-javascript/#addingandremovingrules">http://dev.opera.com/articles/view/dynamic-style-css-javascript/#addingandremovingrules</a>.</p>

<p>Even though there are solutions, it is still a massive pain for users, so please, don&#8217;t use &#8220;!important&#8221; unless you have no other option!</p>]]></content:encoded>
			<wfw:commentRss>http://james.padolsey.com/usability/dont-use-important/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
