I have a CSS file using CSS3PIE behavioral script, so that IE8 will support my files, however, I was wondering if there is any way to make the behavioral URL relative to the CSS file instead of relative to the HTML file. Is there any way to do this?
You could use a path with a preceding slash (from the root of the domain), similar to this:
behavior: url(/css/PIE.htc);
which should work as expected.
Or, you could use the PIE.js version: http://css3pie.com/documentation/pie-js/
Advantages of the JS version - Referencing the PIE.js file via a relative path is simpler ..
But, there are a lot of downsides to PIE.js. Tread carefully.
Another other approach is to use a server-side technology to find the root for you. I use this technique because I tend to develop sites in virtual directories, rather that at the local domain root.
Major downside is that this needs to be done in-code, rather than in a distinct CSS file.
.NET example:
<!--[if lt IE 7]>
<style>
.foo
{
behavior: url(<%= ResolveUrl("~/") %>/js/libs/PIE.htc)
}
</style>
<![endif]-->
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With