How to Apply Conditional Styling for Internet Explorer

Today in this tutorial we are going to teach you that how to apply conditional styling in Internet Explorer and what are some reasons to use them. First off conditional stylesheets can target certain versions of IE or hide certain things from it. It’s a good way to work around the differences Internet Explorer uses in its browser. All this code goes somewhere within the <head></head> tags in your HTML

The example below shows how to target ALL versions of IE.

It is also possible to simply write the CSS for IE right in the conditional stylesheets.

Here’s how to target all versions BEFORE IE 8. The “lt” stands for Less Than.

Here’s how to target all versions ABOVE IE 6. The “gt” stands for Greater Than.

Anyone with previos programming knowledge knows that an an exclamation point “!” means NOT. So to target everything EXCEPT Internet Explorer:

Leave a Reply

Your email address will not be published. Required fields are marked *