{"id":63,"date":"2010-12-13T21:00:55","date_gmt":"2010-12-14T02:00:55","guid":{"rendered":"http:\/\/localhost\/aarontgrogg\/practicalcss3\/"},"modified":"2011-09-18T14:57:23","modified_gmt":"2011-09-18T18:57:23","slug":"internet-explorer-filters","status":"publish","type":"page","link":"https:\/\/aarontgrogg.com\/practicalcss3\/background-gradient\/internet-explorer-filters\/","title":{"rendered":"Internet Explorer Filters"},"content":{"rendered":"<style>div.entry-content div { margin: .75em 0; padding: 10px; border: 3px solid #444; background: #fff;}\n#example1 {\n\tbackground: #d1c26c; \/* Old browsers *\/\n\tbackground-image: -moz-linear-gradient(top, #d1c26c 0%, #e5e2b9 22%, #d1cd96 66%, #b5a75c 100%); \/* FF3.6+ *\/\n\tbackground: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#d1c26c), color-stop(22%,#e5e2b9), color-stop(66%,#d1cd96), color-stop(100%,#b5a75c)); \/* Chrome,Safari4+ *\/\n\tbackground-image: -webkit-linear-gradient(top, #d1c26c 0%,#e5e2b9 22%,#d1cd96 66%,#b5a75c 100%); \/* Chrome10+,Safari5.1+ *\/\n\tbackground-image: -o-linear-gradient(top, #d1c26c 0%,#e5e2b9 22%,#d1cd96 66%,#b5a75c 100%); \/* Opera11.10+ *\/\n\tbackground-image: -ms-linear-gradient(top, #d1c26c 0%,#e5e2b9 22%,#d1cd96 66%,#b5a75c 100%); \/* IE10+ *\/\n\tbackground-image: linear-gradient(top, #d1c26c 0%,#e5e2b9 22%,#d1cd96 66%,#b5a75c 100%); \/* W3C *\/\n}\nhtml.lte9 #example1 {\n\tfilter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#D1C26C', endColorstr='#B5A75C',GradientType=0 ); \/* IE6-9 *\/\n\tzoom: 1; \/* 'hasLayout' required for HTC method *\/\n}\n<\/style>\n<p><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms532997%28v=VS.85%29.aspx\">Internet Explorer Filters<\/a> are a pure CSS implementation that, when used in conjunction with the HTML5 Boilerplate <code>&lt;html&gt;<\/code> conditional comments, requires no hacks and validates (almost) perfectly!<\/p>\n<p>Note that gradients display a color <em>between<\/em> an element&#8217;s background its and content (meaning an element&#8217;s background color will shine through the gradient).<\/p>\n<p>Also note that this CSS will not validate because <code>filter<\/code> is invalid.  If validation is important to you, this could be served via an IE-only stylesheet.<\/p>\n<p>Lastly, note that Firefox 3.5- and, as of this writing, Opera, do not support background gradients, so if you are concerned with either of these browser versions, you might want to also include a background gradient image.  By referencing the <code>no-cssgradients<\/code> class, and placing it before the <code>.ie<\/code> class, you prevent the image from being downloaded by browsers that <em>do<\/em> support background gradients), even though it doesn&#8217;t really need it, IE <em>would<\/em> get the download&#8230;I never said this would all be perfect&#8230;<\/p>\n<p>Okay, <em>really<\/em> the last note, here is <a href=\"http:\/\/chetzit.com\/blog\/css\/19.html\">another alternative for Opera<\/a>, again, if you&#8217;re really interested.<\/p>\n<pre>\r\n#example1 {\r\n\tbackground: #d1c26c; \/* Old browsers *\/\r\n\tbackground-image: -moz-linear-gradient(top, #d1c26c 0%, #e5e2b9 22%, #d1cd96 66%, #b5a75c 100%); \/* FF3.6+ *\/\r\n\tbackground: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#d1c26c), color-stop(22%,#e5e2b9), color-stop(66%,#d1cd96), color-stop(100%,#b5a75c)); \/* Chrome,Safari4+ *\/\r\n\tbackground-image: -webkit-linear-gradient(top, #d1c26c 0%,#e5e2b9 22%,#d1cd96 66%,#b5a75c 100%); \/* Chrome10+,Safari5.1+ *\/\r\n\tbackground-image: -o-linear-gradient(top, #d1c26c 0%,#e5e2b9 22%,#d1cd96 66%,#b5a75c 100%); \/* Opera11.10+ *\/\r\n\tbackground-image: -ms-linear-gradient(top, #d1c26c 0%,#e5e2b9 22%,#d1cd96 66%,#b5a75c 100%); \/* IE10+ *\/\r\n\tbackground-image: linear-gradient(top, #d1c26c 0%,#e5e2b9 22%,#d1cd96 66%,#b5a75c 100%); \/* W3C *\/\r\n}\r\nhtml.lte9 #example1 {\r\n\tfilter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#D1C26C', endColorstr='#B5A75C',GradientType=0 ); \/* IE6-9 *\/\r\n\tzoom: 1; \/* 'hasLayout' required for HTC method *\/\r\n}\r\n<\/pre>\n<div id=\"example1\">\n<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.<\/p>\n<\/p><\/div>\n<aside>Note that <code>filter<\/code>s <strong>cannot<\/strong> do color-stops, they can <strong>only<\/strong> go from one color to another.  If you need multiple color-stops, consider the <a href=\"https:\/\/aarontgrogg.com\/practicalcss3\/background-gradient\/css3-pie\">CSS3 Pie<\/a> option.<\/aside>\n","protected":false},"excerpt":{"rendered":"<p>Internet Explorer Filters are a pure CSS implementation that, when used in conjunction with the HTML5 Boilerplate &lt;html&gt; conditional comments, requires no hacks and validates (almost) perfectly! Note that gradients display a color between an element&#8217;s background its and content &hellip; <a href=\"https:\/\/aarontgrogg.com\/practicalcss3\/background-gradient\/internet-explorer-filters\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":29,"menu_order":1,"comment_status":"open","ping_status":"open","template":"","meta":{"webmentions_disabled_pings":false,"webmentions_disabled":false,"footnotes":""},"class_list":["post-63","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/aarontgrogg.com\/practicalcss3\/wp-json\/wp\/v2\/pages\/63","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/aarontgrogg.com\/practicalcss3\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/aarontgrogg.com\/practicalcss3\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/aarontgrogg.com\/practicalcss3\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/aarontgrogg.com\/practicalcss3\/wp-json\/wp\/v2\/comments?post=63"}],"version-history":[{"count":0,"href":"https:\/\/aarontgrogg.com\/practicalcss3\/wp-json\/wp\/v2\/pages\/63\/revisions"}],"up":[{"embeddable":true,"href":"https:\/\/aarontgrogg.com\/practicalcss3\/wp-json\/wp\/v2\/pages\/29"}],"wp:attachment":[{"href":"https:\/\/aarontgrogg.com\/practicalcss3\/wp-json\/wp\/v2\/media?parent=63"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}