<?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>The Bright Lines &#187; IE</title>
	<atom:link href="http://www.thebrightlines.com/tag/ie/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thebrightlines.com</link>
	<description>HTML, CSS, Javascript and more</description>
	<lastBuildDate>Thu, 29 Jul 2010 22:44:34 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Cool cross-browser styling with CSS and IE&#8217;s filter</title>
		<link>http://www.thebrightlines.com/2009/12/03/using-ies-filter-in-a-cross-browser-way/</link>
		<comments>http://www.thebrightlines.com/2009/12/03/using-ies-filter-in-a-cross-browser-way/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 20:35:22 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[cross-browser]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[IE]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=174</guid>
		<description><![CDATA[A few new and cool CSS3 styles become realistic options when building a website if you combine them with IE's filter.]]></description>
			<content:encoded><![CDATA[<p><a class="button demo" href="/article-data/demo/CSS3/CSS3.html" target="_blank"><span> </span>View demo</a>
<div class="clear"></div>
<p>A few new and cool CSS3 styles become realistic options if you are designing website. That is: as long as you combine them with IE’s counterpart filter.</p>
<p>The list of things that Safari, Chrome and Firefox support is getting larger and larger. Not all functionality is that interesting since we still have to make sure that IE users receive a functional site. And if you&#8217;re building something for a customer, you have to make sure that the website looks like what the customer expects it to look like. Most of the time that means that the website must be more or less an exact copy of the designs in Photoshop.</p>
<p>But what is easily forgotten is that for years Internet Explorer sort of supports some CSS styles through the proprietary <code>filter</code> property. I mostly use <code>filter</code> for setting opacity or forcing alpha channels in a PNG24, but when I saw a text shadow in a website I realized that IE can do that trick already for years. So I came up with this list of things that should work on almost any browser:</p>
<ul>
<li>Text shadow</li>
<li>Box shadow</li>
<li>Blur</li>
<li>Gradient background</li>
<li>Opacity</li>
<li>PNG24 alpha</li>
</ul>
<h2>A little on browser support</h2>
<p>A little warning about the “works in”-lines you&#8217;ll seewith each example. I didn&#8217;t dig very deep to see which version of Opera started to support text-shadow. If see in a support chart that Opera 9.62 supports text-shadow, I haven&#8217;t dug deeper to if it was also supported in Opera 9.61. Especially when I relate it to the small share of people who use that browser. If you can point a source that speaks of an earlier version, I&#8217;m more than happy to correct the article.</p>
<h2>Things you can do with CSS and filters combined</h2>
<h3>Text shadow</h3>
<p><strong>Works in IE 5.5+, Firefox 3.1b+, Safari 3+, Chrome 2+ and Opera 9.62+</strong><br />
Used sparingly can create a nice subtle effect and is a great way to make something a bit more stylish. Watch out with loss of anti-alias. More on that issue at the end of the article.</p>
<div class="wp-caption alignleft" style="width: 163px"><img title="Text-shadow in IE8" src="/article-data/images/IE-filter-textshadow-ie.png" alt="Text-shadow in IE8" width="153" height="13" /><p class="wp-caption-text">Text-shadow in IE8</p></div>
<div class="wp-caption alignleft" style="width: 165px"><img title="Text-shadow in Firefox 3.5.5" src="/article-data/images/IE-filter-textshadow-ff.png" alt="Text-shadow in Firefox 3.5.5" width="155" height="14" /><p class="wp-caption-text">Text-shadow in Firefox 3.5.5</p></div>
<pre name="code" class="css:nogutter">.textShadow {
	width: 250px;
	text-shadow: 1px 1px 1px #cccccc; /* CSS3-compatible browsers */
	filter: dropshadow(color=#cccccc, offx=1, offy=1) /* IE */
}</pre>
<h3>Blur</h3>
<p><strong>Works in IE 5.5+, Firefox 3.1b+, Safari 3+, Chrome 2+ and Opera 9.62+</strong><br />
This one is a bit of hack: CSS3&#8217;s <code>text-shadow</code> is misused to create a blur. It was a trick I saw on www.css-tricks.com (hence the name, I guess). And although you can see the differences between the two screenshots, both are definitely blurs. A <a href="/conditional-comments/">conditional comment</a> was used to make the text in IE a bit darker so it would match with other browsers.</p>
<div class="wp-caption alignleft" style="width: 79px"><img title="Blur in IE8" src="/article-data/images/IE-filter-blur-ie.png" alt="Blur in IE8" /><p class="wp-caption-text">Blur in IE8</p></div>
<div class="wp-caption alignleft" style="width: 85px"><img title="Blur in Firefox 3.5.5" src="/article-data/images/IE-filter-blur-ff.png" alt="Blur in Firefox 3.5.5" /><p class="wp-caption-text">Blur in Firefox 3.5.5</p></div>
<pre name="code" class="css:nogutter">.blur {
	width: 250px;
	color: #ddd;
	text-shadow: 0 0 2px #aaaaaa;
	text-shadow: 0 0 4px #aaaaaa;
	text-shadow: 0 0 6px #aaaaaa;
	filter:
		progid:DXImageTransform.Microsoft.MotionBlur(strength=1,direction=310)
		progid:DXImageTransform.Microsoft.Blur(pixelradius=2);
}</pre>
<pre name="code" class="css:nogutter">&lt;!--[if IE]&gt;
	&lt;style type="text/css"&gt;
		/* This style is for IE browsers only by
		   using IE's Conditional Comments */
		.blur {
			color: #aaaaaa;
		}
	&lt;/style&gt;
&lt;![endif]--&gt;</pre>
<h3>Opacity</h3>
<p><strong>Works in IE 5.5+ and in all major browsers for years and is safe to use</strong><br />
Definitely the most used combination of CSS and IE&#8217;s filter. I mostly use it to make the website almost invisible in favor of an absolute placed <code>div</code> which floats like popup window on top of the greyed out website.</p>
<div class="wp-caption alignleft" style="width: 149px"><img title="Opacity 0.5 in IE8" src="/article-data/images/IE-filter-opacity-ie.png" alt="Opacity 0.5 in IE8" /><p class="wp-caption-text">Opacity 0.5 in IE8</p></div>
<div class="wp-caption alignleft" style="width: 149px"><img title="Opacity 0.5 in Firefox 3.5.5" src="/article-data/images/IE-filter-opacity-ff.png" alt="Opacity 0.5 in Firefox 3.5.5" /><p class="wp-caption-text">Opacity 0.5 in Firefox 3.5.5</p></div>
<pre name="code" class="css:nogutter">.opacity {
	width: 250px;
	opacity: 0.5;
	-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";/*IE8+*/
	filter: alpha(opacity=50); /* IE7 and lower */
}</pre>
<h3>Gradient</h3>
<p><strong>Works in IE 5.5+, Firefox 3.6+, Safari4, Chrome 3+</strong><br />
The soon to be released Firefox 3.6 supports gradient background. Safari and Chrome already supports that cool CSS3 feature. Although you can do more with CSS3&#8217;s background gradient than IE&#8217;s filter, there&#8217;s nothing to stop you from using a simple gradient. Well, poor browser support may stop you. Firefox 3.6 still has to be released and Opera does not seem to support gradients at all.</p>
<p>So the browser support for gradients is less than desirable. But since all major browsers except Opera now supports gradients in their latest versions, it will become a useful styling tool soon.</p>
<div class="wp-caption alignleft" style="width: 180px"><img title="Background gradient in IE8" src="/article-data/images/IE-filter-gradient-ie.png" alt="Background gradient in IE8" /><p class="wp-caption-text">Background gradient in IE8</p></div>
<div class="wp-caption alignleft" style="width: 180px"><img title="Background gradient in Chrome 3.0" src="/article-data/images/IE-filter-gradient-chrome.png" alt="Background gradient in Chrome 3.0" /><p class="wp-caption-text">Background gradient in Chrome 3.0</p></div>
<pre name="code" class="css:nogutter">.gradient {
	background: -moz-linear-gradient(top, bottom,from(#cccccc),to(#888888));
	background: -webkit-gradient(linear, left top, left bottom, from(#cccccc), to(#888888)) no-repeat;
	background; -o-gradient(top, bottom,from(#cccccc),to(#888888));
	-ms-filter: "progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#ffcccccc, endColorstr=#ff888888)"; /* IE8+ */
	filter: progid:DXImageTransform.Microsoft.gradient (GradientType=0, startColorstr=#ffcccccc, endColorstr=#ff888888); /* IE7 and lower */
}</pre>
<h3>Box shadow</h3>
<p><strong>Works in IE 5.5+, Firefox 3.6+, Safari 3, Chrome 1</strong><br />
If you look at the screenshots below you see a striking difference in what is called a “Shadow“. IE&#8217;s box shadow looks more like the right and bottom side of a 3D object than a real life shadow. CSS3&#8217;s box-shadow provides a shadow that&#8217;s much more realistic.</p>
<p><img title="Box shadow in IE8" src="/article-data/images/IE-filter-shadow-ie.png" alt="Box shadow in IE8" /><img title="Box shadow in Firefox 3.5.5" src="/article-data/images/IE-filter-shadow-ff.png" alt="Box shadow in Firefox 3.5.5" /></p>
<pre name="code" class="css:nogutter">.boxShadow {
	-moz-box-shadow: 5px 5px 5px #888;
	-webkit-box-shadow: 5px 5px 5px #888;
	-ms-filter: "progid:DXImageTransform.Microsoft.Shadow(color=#888888,direction=125,strength=5)"; /* IE8+ */
	filter: progid:DXImageTransform.Microsoft.Shadow(color=#888888,direction=125,strength=5); /* IE7 and lower */
	background: #cccccc;
}</pre>
<h3>Use alpha channel in PNG24 images</h3>
<p>Not really a CSS feature, neither something that lacks in modern IE browsers. But it is dearly missed in IE6. The only way to use alpha channels in IE6 (although many have found different ways apply it) is by using the filter&#8217;s AlphaImageLoader. Although this filter can save the day, it has many bugs you need to be aware of:</p>
<ul>
<li>It can only be used as a background image.</li>
<li>You cannot position it like a normal background image, nor can the image repeat itself on the <code>x</code> or <code>y</code> axis.</li>
<li>Links or form elements inside a box with a transparent PNG24 are not clickable. You have to make sure that such elements have a parent that has <code>position: relative</code>.</li>
<li>Having lots of relative positioned elements scattered around can add extra complexity to your website if it has absolute positioned items floating on top of each other as well.</li>
<li>You&#8217;ll lose text anti-alias.</li>
</ul>
<p><strong>This technique is only needed in IE6. Other modern browsers use the alpha channel as it ought to be.</strong></p>
<pre name="code" class="css:nogutter">.imageAlpha {
	display: block;
	width: 250px;
	height: 40px;
	padding: 5px 10px;
	background: #aaf url(alpha.png) 0 0 repeat-x; /* PNG24 image with alpha layer that works in all modern browsers */
}
* html .imageAlpha { /* these styles are only picked up by IE6 */
	background-image: none;
	filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='alpha.png', sizingMethod='scale')
}</pre>
<h2>Filter bugs</h2>
<h3>Filter can clear Cleartype</h3>
<p>The main drawback of using IE&#8217;s <code>filter</code> is that in some cases the element that has a filter style in IE, will lose it&#8217;s anti-aliasing. That may not sound like a big deal, because we have lived for a long time without Microsoft&#8217;s Cleartype, but it can get real ugly with larger fonts as you can see in the screenshots below. If you use a filter and it does remove the Cleartype, it&#8217;s best to keep the font-size 16 pixels or lower.</p>
<p><img title="IE filters in Arial 16px" src="/article-data/images/IE-filter2.png" alt="IE filters in Arial 16px" /><img title="IE filters in Georgia 19px" src="/article-data/images/IE-filter1.png" alt="IE filters in Georgia 19px" /></p>
<h3>Filters can only be applied to boxes</h3>
<p>Filters can only be applied to block elements like <code>div</code> or <code>p</code> and they need a width or height. If not, the filter won&#8217;t work. The exception to the rule is IE8, which can show filter effects without a width or height.</p>
<p><a class="button demo" href="/article-data/demo/CSS3/CSS3.html" target="_blank"><span> </span>View demo</a>
<div class="clear"></div>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2009/12/03/using-ies-filter-in-a-cross-browser-way/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>What you can&#8217;t do in IE&#8217;s Quirks Mode</title>
		<link>http://www.thebrightlines.com/2009/11/27/filtering-ie6-and-ie7-in-quirks-mode/</link>
		<comments>http://www.thebrightlines.com/2009/11/27/filtering-ie6-and-ie7-in-quirks-mode/#comments</comments>
		<pubDate>Thu, 26 Nov 2009 23:00:26 +0000</pubDate>
		<dc:creator>Wouter Bos</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Standards]]></category>

		<guid isPermaLink="false">http://www.thebrightlines.com/?p=146</guid>
		<description><![CDATA[If you're accustomed to make websites by following the W3C guidelines, you'll be suprised what you can't do in IE when you have to work on a site that runs in IE's Quirks Mode (at least I was).]]></description>
			<content:encoded><![CDATA[<p>As most of you probably know IE can render websites in either Quirks Mode or Standards Compliant Mode. Standards Mode is the mode that is most compatible with other browsers like Firefox, while Quirks Mode exists for backwards compatibility purposes. IE automatically chooses one of these modes by looking at the first line of the HTML code. Check out <a href="http://www.quirksmode.org/css/quirksmode.html">Quirksmode.org</a> and <a href="http://en.wikipedia.org/wiki/Quirks_mode">Wikipedia</a> if you want to know more about both modes and how to trigger them. But in case you want the short summary: if you don&#8217;t start your document with a DTD like the example below, IE will render the website in Quirks Mode.</p>
<p><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;</code></p>
<p>I only build websites in Standards Mode, so Quirks Mode is an almost non-existent issue for me. This week, however, I had to restyle an old website. And while rewriting the CSS I remembered that the difference between the two modes goes farther than just a difference in <a href="http://en.wikipedia.org/wiki/Internet_Explorer_box_model_bug">box model</a>. Simple things you&#8217;ve learned to rely on in Standards Mode are gone in Quirks Mode.</p>
<h2>No <code>* html</code></h2>
<p>If I want a class to specifically target IE6 or IE7 I always prepend selectors with <code>* html</code> (IE6) or <code>*:first-child+html</code> (IE7) in case the rendering is a bit off with other browsers. But that simply doesn&#8217;t work in Quirks Mode. On Wikipedia there&#8217;s a <a href="http://en.wikipedia.org/wiki/CSS_filter">list of browser bugs you can exploit in CSS</a>. I chose to exploit the &rdquo;<code>!important</code> quirk&ldquo; since future browsers will just ignore the invalid CSS code that only runs in IE6 and IE7.</p>
<p>To use the &rdquo;<code>!important</code> quirk&ldquo; you misuse the <code>!important</code> keyword. Normally that keyword is used like this:</p>
<pre name="code" class="css:nogutter">
.classname {
    width: 100px !important;
}
</pre>
<p>The <code>!important</code> keyword ensures that the width of 100px cannot be overruled by other styles unless you use another <code>!important</code>. In IE6 and IE7 any keyword that starts with a <code>!</code> works like a <code>!important</code>, so you can write something like this:</p>
<pre name="code" class="css:nogutter">
.classname {
    width: 100px; /* works in all 'normal' browsers' */
    width: 150px !lteIE7; /* for IE 7 and lower */
}
</pre>
<h2>No fancy selectors</h2>
<p>What surprised me much more is that some advanced selectors like the attribute selectors are not possible in IE7 when running in Quirks Mode. So the CSS code below will only work in Standards Mode:</p>
<pre name="code" class="css:nogutter">
table[width='160'] { /* this selector will not run in IE7 Quirks Mode */
    width: 100px;
}
</pre>
<p>The same holds true for selectors like <code>:first-child</code>, the Adjacent Sibling (<code>+</code>) Combinator and the Child (<code>&gt;</code>) Combinator. Bummer.</p>
<h2>Why not use conditional comments?</h2>
<p>If you want to have some classes that are specifically targeted towards IE6 and IE7, Conditional Comments are the easiest and safest thing.</p>
<p><code>&lt;!--[if lt IE 6]&gt;<br />
&lt;link href='/css/IE6.css' rel='stylesheet' type='text/css' media='all' /&gt;<br />
&lt;![endif]--&gt;<br />
</code></p>
<p>But I prefer CSS filters above conditional comments. By using CSS filters I have all the styling of an element in one page and not scattered around in different CSS files. In most cases I only use conditional comments to hide CSS code that won&#8217;t validate.</p>
<p><a href="/conditional-comments/">More information about conditional comments</a></p>
<p><span style="font-size: 0.8em">Code for the sake of Technorati: 4252WKT38H9D</span></p>


<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://www.thebrightlines.com/2009/11/27/filtering-ie6-and-ie7-in-quirks-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
