How to download css3 pie only for ie7 and 8? But not for 9

This is css for using CSS3 PIE

border: 1px solid #696; padding: 60px 0; text-align: center; width: 200px; -webkit-border-radius: 12px; -moz-border-radius: 12px; border-radius: 12px; background: #EEFF99; behavior: url(/PIE.htc); 

Specially

 behavior: url(/PIE.htc); 

My question is, will this PIE.htc be downloaded by all browsers or only in IE 7 and 8?

I need to show a round corner in IE7 and 8 too. So I thought that instead of using Modernizr and writing a different class and image for a round corner, CSS3 PIE would be a good solution, because whenever we change the color and thickness of the border and the height of the element, PIE.htc will display the same in IE7 and 8 without, but in the case of Modernizr and the image, we will need to use the upload of a new image for a new one, we will need to change and upload new changes.

And since I use Modernizr for this, I cannot load in the conditional comment that it will load for each browser, even I do not need it. So I thought that if CSS3 PIE is good for flexibility, and if it will only load in IE7 and 8, it will be useful to use in this particular case.

+2
css cross-browser internet-explorer modernizr css3pie
Dec 17 '11 at 14:50
source share
1 answer

behavior not a valid CSS property and will be ignored by browsers other than Internet Explorer. They will not load the PIE.htc file.

You mentioned that you cannot load a conditional comment , but if you can use conditional comments (?), You can do the following trick:

 <!doctype html> <!--[if IE 7]><html class="ie7"><![endif]--> <!--[if IE 8]><html class="ie8"><![endif]--> <!--[if gt IE 8]><!--><html><!--<![endif]--> <head> 

In this case, you are using conditional comments, but you are not loading anything inside the comments. You simply add a browser-specific class to the <html> element. Now you can do this in your CSS:

 .some-class { border-radius: 12px; } .ie7 .some-class, .ie8 .some-class { behavior: url(/PIE.htc); } 
+9
Dec 17 '11 at 3:19
source share



All Articles