CSS hack: Difference between revisions

Content deleted Content added
Random832 (talk | contribs)
Meitar (talk | contribs)
m Conditional Comments: Minor grammatical/typo fixes.
Line 1:
A '''CSS filter''' is a coding technique that aims to effectively hide or show parts of the [[Cascading style sheets|CSS]] to different [[Web browser|browsers]], either by exploiting CSS-handling quirks or bugs in the browser or by taking advantage of lack of support for parts of the CSS specifications. Using CSS filters, some designers have gone as far as delivering entirely different CSS to certain browsers in order to ensure that designs are rendered as expected. Because very early web browsers either were completely incapable of handling CSS or rendered CSS very poorly, designers today often routinely use CSS filters that completely prevent these ancient browsers from 'seeing' any of the CSS. For example, CSS filters are very often put in place to exclude Netscape 4.xx and Internet Explorer 4, ensuring that only more recent 'v5' browsers 'see' the CSS.
=== Conditional Comments ===
Conditional Comments are supported by Microsoft Internet Explorer (version 5 onwards[http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp]). theyThey allow web developers to show or hide html[[HTML]] code based on the version of the viewer's browser.
 
There are two types of conditional commentcomments, downlevel revealed which is a proprietary Microsoft HTML tag and downlevel hidden which are ignored by non Microsoft browsers because they are treated as a standard comment.
 
Conditional comments can be used to hide certain styles from a specific browser, or even to supply a tailored style sheets for individual browser versions.
 
This is an example of a "downlevel hidden" conditional comment (that is, the content is only visible to IE).
<pre>
<!--[if IE 7]>
Line 14:
</pre>
 
This is an example of a "downlevel revealed" conditional comment, which is recommended by microsoft for when the content should be exposed to non-IE browsers.
<pre>
<![if !IE]>