Tuesday, January 27th, 2009
This is a fun little hack by Manfred Staudinger.
To include a link or a style element for one of the above choices you use the dr:select attribute and specify one or more tokens as a comma separated list. For example dr:select=”Firefox, Safari 3″ will cause the link or style element to be included for any Firefox and for Safari 3. If you specify more than one token, each of which constitutes a positive selection, you may use any combination of tokens from the non-IE browsers plus the token “IE”.
To select a specific IE only one token in the dr:select attribute is allowed, because it is directly used in constructing a Conditional Comment (CC). These are constructed on the fly only if the current browser is actually an IE. Any valid CC expression is allowed, so you can specify for example dr:select=”lte IE 7″ (positive selection) or dr:select=”!IE 6″ (negative selection). To clarify, a positive CC selection will allow only the IE’s specified to read the CSS, and a negative CC will exclude them from seeing it. The best, you don’t need anymore to include Microsoft proprietary CC’s for selecting CSS in your HTML!
Link and style elements without a dr:select attribute are considered common stylesheets which every browser will see. They will remain unchanged, as any other HTML element. Only the dr:select attributes will be nullified.
Posted by Dion Almaer at 5:50 am