cssinternet-explorersasshtml-components

IE CSS * hack and HTC files


Quick question about using .htc files in CSS.

If I use * to stop anything but IE using the style and it's a file I'm using it on (htc, image etc), do other browsers load it in as well?

I've got a SASS mixin for box sizing but don't want to load the htc file if I don't have to.

// Box sizing
@mixin box-sizing($boxmodel) {
    -webkit-box-sizing: $boxmodel;
        -moz-box-sizing: $boxmodel;
        -ms-box-sizing: $boxmodel;
            box-sizing: $boxmodel;

    @if $boxmodel == border-box {
        *behavior: url(/js/boxsizing.htc);
    }
}

Thanks


Solution

  • Other browsers don't identify behavior as a valid CSS attribute, so your .htc file will not be loaded by anything than IE.