Forum Moderators: open
<style type="text/css">
@import "mycss.css?lang=en&jazz=true";
</style>
works great but does not validate. The validator suggests to replace the ampersand with its html entity (&) but when I do, only the lang variable gets passed.
The way around I am using is to replace the ampersand by a vertical bar then explode the string to retrive the variables.
Is the validator lying? Do I really need to do that? is there another way to encode an ampersand other than html entity and %26 (which does the same thing as the html entity, only the first variable is passed)
My first thought is to wonder how many different versions of a css file you need? Is it really so many that a dynamic approach is mandatory? And if that is the case, could you dynamially cascade a few extra but small css files in, each with the specific required changes? You could build the css cascade dynamically but avoid using 2-variable query strings to do it.
And second, if you have a tested and functional page that doesn't validate, but you know why and you choose that exception intentionally - it's just not the end of the world.
If your need is for a different style sheet in different situations, couldn't you create differently named style sheets and then have PHP (or whatever language you're using) determine which is needed and then write a different file name into the HTML? That way, the import element wouldn't need any? or &.