If you are a Web Designer or Developer and looking for a CSS hacks then this post going to help you. In this post I am going to share 4 different types of CSS hacks you can use.
Here’s the following list:
Following are the good example of Conditional stylesheet for Internet Explorer. Conditional comments used easily to specify stylesheets that should only be loaded in IE, or even in specific versions of that browser. Don’t worry about Non-IE browsers, it treats conditional comments as HTML comment.
Above CSS hack used differently in specific versions of IE, it would look something like this:
If you don’t want to use CSS hacks, you can apply conditional classnames to the
element. This approach allows you to write clean and hack-free CSS at the cost of adding hacks conditional comments to your HTML.
This allows you to keep your browser-specific CSS in the same file:
Here’s an overview of the four most popular CSS hacks and which browsers they’re supposed to target:
Using conditional classnames with CSS hacks
In the HTML, you can use a minimal version of the conditional classnames technique, like this:
You can then use
as a styling hook in CSS selectors to target IE8 and older versions. Combined with CSS hacks, you can finally target IE8 and older versions without also affecting IE9: