Browser Specific CSS Hack

CSS Hack for different browsers without writing separate CSS file

Here, I'm going to discuss about the one way of css hack for different browsers with out going for separate file. Sometimes, we have to restrict ourselves to not keeping the all the css for specific browser in different file. For this reason, following js file is helpful.
For clean code, you might make use of the javascript file here:
By including the line:
<script src="css_browser_selector.js" type="text/javascript"></script>
You can write subsequent css with the following simple pattern:
.ie7 [thing] {
  background-color: orange
}
.chrome [thing] {
  background-color: gray
}
This js file will add corresponding classes of browser name, operating version and other things to HTML tag. So, we can make use of them and target specific browser.
I'm sure there are other ways of css browser hacks. Thanks for Reading!

Comments

Popular posts from this blog

Gradient Border Colors with CSS

10 Useful Libraries and Resources for Responsive Web Design

The Simplest Way To Center Elements Vertically And Horizontally