{"id":220,"date":"2011-06-07T17:41:48","date_gmt":"2011-06-07T16:41:48","guid":{"rendered":"http:\/\/www.cotsweb.com\/blog\/?p=220"},"modified":"2011-06-07T17:43:31","modified_gmt":"2011-06-07T16:43:31","slug":"ie9-is-better-but-it-is-still-internet-explorer","status":"publish","type":"post","link":"https:\/\/www.cotsweb.com\/blog\/ie9-is-better-but-it-is-still-internet-explorer-220.html","title":{"rendered":"IE9 is better but it is still Internet Explorer"},"content":{"rendered":"<p>I recently built a new website for <a title=\"MAC Eyewear stocks designer spectacle frames for opticians\" href=\"http:\/\/www.maceyewear.co.uk\">MAC\u00a0Eyewear,\u00a0a local supplier of \u00a0designer spectacle frames<\/a>. \u00a0I decided that the time had come to embrace some of the newer facilities available in CSS3. \u00a0In the past I haven&#8217;t used them much because too many people can&#8217;t see them in their browsers.<\/p>\n<p>Now I figure that a good proportion of people are using Firefox 3.6 or later, Chrome, Opera, Safari or Internet Explorer 9 (actually not too many of them yet but it is growing). \u00a0As long as what I did still looked ok in the older browsers I thought I would try out enhancements to make the site look a bit prettier.<\/p>\n<p>So I styled the supplier images with rounded corners and drop shadows;<\/p>\n<p><pre><code class=\"preserve-code-formatting\">img.supplier {\nfloat: left;\nmargin: 1em;\nvertical-align:&nbsp;&nbsp; top;\nborder: 4px solid #888;\nborder-radius: 5px;\n-moz-border-radius: 5px;\nbox-shadow: 4px 4px 4px #888;\n-moz-box-shadow: 4px 4px 4px #888;\n\/* \u00a0 filter: progid:DXImageTransform.Microsoft.DropShadow(offx=4, offy=4, color=#888888);&nbsp;&nbsp;*\/\n}<\/code><\/pre><\/p>\n<h2>Browser Support<\/h2>\n<p>The rounded corners are supplied by the border-radius directives and the drop shadows by the box-shadow directives.<br \/>\nI have also used the -moz versions of these directives to keep Firefox 3.6 happy (quite a few people haven&#8217;t yet moved to FF4), Firefox 4, Opera, Chrome and IE9 are happy with the standard directives.  Safari uses the border-radius but doesn&#8217;t yet support box-shadow, it probably supports the -webkit version but I think it will catch up with Chrome pretty soon so I didn&#8217;t bother adding another line of code which would soon be redundant.<\/p>\n<p>Now older browsers like IE6, IE7 &amp; IE8 don&#8217;t support the CSS3 rounded corners or drop shadows but IE has supported drop shadows by a\u00a0proprietary directive\u00a0for a long time, so I added a filter directive to give the drop shadows. \u00a0All sorted!<\/p>\n<h2>But IE9 supports CSS3 AND filters<\/h2>\n<p>Oops! When I tested this in IE9 I discovered a problem, IE9 being a modern browser provides pretty good support for the CSS3 directives, but it is still Internet Explorer and also supports the filter directive.<\/p>\n<p>The results weren&#8217;t very pretty, nice rounded corners and drop shadow with an ugly square drop shadow behind it. \u00a0This is why the last directive in the CSS above is commented out.<\/p>\n<p>I needed a separate stylesheet to give the extra instructions to the older versions of Internet Explorer but not to IE9.  So where I called the main stylesheet in my HTML page I added an extra bit of code.<\/p>\n<p><pre><code class=\"preserve-code-formatting\">&lt;link href=&quot;stylesheet.css&quot; rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; \/&gt;\n&lt;!--[if lt IE 9]&gt;\n&lt;link href=&quot;stylesIE.css&quot; rel=&quot;stylesheet&quot; type=&quot;text\/css&quot; \/&gt;\n&lt;![endif]--&gt;<\/code><\/pre><br \/>\nA small extra stylesheet which just applies the filter directive will be included but only for Internet Explorer versions less than 9, any other browser won&#8217;t include the extra stylesheet;<\/p>\n<p><pre><code class=\"preserve-code-formatting\">\/*\n* This stylesheet contains only those styles which we need to make IE versions less than 9 work properly\n* IE9 is close enough to a modern browser that it can use the main stylesheet\n*\/\n\nimg.supplier {\n&nbsp;&nbsp;&nbsp;&nbsp;filter: progid:DXImageTransform.Microsoft.DropShadow(offx=4, offy=4, color=#888888);&nbsp;&nbsp;\n}\n<\/code><\/pre><br \/>\nI think the results are pretty good.  People with older browsers see a nice site with the added drop shadows if they are using Internet Explorer.  People with modern browsers see an even nicer site with proper CSS3 rounded corners and drop shadows.  None of it is ugly but people with modern browsers get the benefit.<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>I recently built a new website for MAC\u00a0Eyewear,\u00a0a local supplier of \u00a0designer spectacle frames. \u00a0I decided that the time had come to embrace some of the newer facilities available in CSS3. \u00a0In the past I haven&#8217;t used them much because too many people can&#8217;t see them in their browsers. Now I figure that a good [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[33,103,18,12],"tags":[138,34,149,35,104,62],"_links":{"self":[{"href":"https:\/\/www.cotsweb.com\/blog\/wp-json\/wp\/v2\/posts\/220"}],"collection":[{"href":"https:\/\/www.cotsweb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cotsweb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cotsweb.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cotsweb.com\/blog\/wp-json\/wp\/v2\/comments?post=220"}],"version-history":[{"count":8,"href":"https:\/\/www.cotsweb.com\/blog\/wp-json\/wp\/v2\/posts\/220\/revisions"}],"predecessor-version":[{"id":228,"href":"https:\/\/www.cotsweb.com\/blog\/wp-json\/wp\/v2\/posts\/220\/revisions\/228"}],"wp:attachment":[{"href":"https:\/\/www.cotsweb.com\/blog\/wp-json\/wp\/v2\/media?parent=220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cotsweb.com\/blog\/wp-json\/wp\/v2\/categories?post=220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cotsweb.com\/blog\/wp-json\/wp\/v2\/tags?post=220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}