User Stylesheets

The stylesheets that you create for your web site are usually referred to as author stylesheets because you as the author of the web site have created them.

Some web browsers allow the person using the computer to define their own stylesheets for use with that browser. These stylesheets are referred to as user stylesheets because they are created by the user.

If your visitors have created their own user stylesheets then you have still more stylesheets to worry about when trying to determine how elements on your page will appear and in this case you don't even know whether there is such a user stylesheet let alone what values such a stylesheet might contain.

How it should work is that both the author and user stylesheets should be taken into account when applying styles to the page and that the author stylesheet should take precedence for any attributes except when they are defined as !important in the user styleseet in which case the user stylesheet value should override the author stylesheet unless the attribute is also defined as !important in the author stylesheet.

If browsers were to actually apply this then you would be able to define those attributes critical to your page operation as !important while allowing your visitors to override the other attributes if they so desire. Your page would look much as you intend it to and the positioning and dynamic functionality in your page would work as required.

How it works in practice with current browsers varies depending on which browser your visitor is using. If they are using Internet Explorer then their user stylesheet will always override your author stylesheet. Firefox and Opera behave closer to the ideal with author styles taking preference except where the user stylesheet has the rule marked as !important in which case the user stylesheet takes priority.

 

This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow
Donate