Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

css3pie: Does CSS behavioral property allow relative URLs?

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?

like image 971
Travis Pessetto Avatar asked Jun 20 '11 21:06

Travis Pessetto


2 Answers

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.

like image 189
thirtydot Avatar answered Sep 30 '22 12:09

thirtydot


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]-->
like image 21
graphicdivine Avatar answered Sep 30 '22 12:09

graphicdivine