Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it a good technique to load different CSS for different browsers?

Tags:

browser

css

I have designed many web-templates. But (except my first one) I've never used browser detection scripts to load corresponding CSS.

I am not sure whether it is a good technique, or just an alternative way (to struggle with a single CSS to satisfy all the browsers)?

like image 775
InfantPro'Aravind' Avatar asked Feb 11 '10 10:02

InfantPro'Aravind'


People also ask

Should you use different CSS files for different pages?

you should keep only one css file. Let me tell you in simple one line, once your website loads in client web browser the static resource can be cached that helped your website to boost and number of web request can be reduce when user browse multiple pages of your website. Save this answer.

Is it better to have one or multiple CSS files?

Having only one CSS file is better for the loading-time of your pages, as it means less HTTP requests. Having several little CSS files means development is easier (at least, I think so : having one CSS file per module of your application makes things easier). So, there are good reasons in both cases...

Which browser is better for CSS?

Firefox Developer The standard edition of Firefox is an excellent browser, packed with features, and privacy-focused. The developer edition adds to this with a suite of tools aimed at developers. The CSS and JavaScript debugging tools are superb, and the Grid tools are unparalleled for coding layouts with CSS Grid.


1 Answers

It depends on how complex your layout is.

On the whole, there are a set of "problem features" with some browsers, such as the browser not following the border-box model and assigning margin, border and padding values incorrectly.

Many designs aren't affected by the problems and look very similar in all browsers, but if you have a part of your design that has a touch point on one of the issues, it is probably better to extract the "fixes" into a separate stylesheet, rather than pollute your standard CSS with hacks.

You should find that you have

1 Stylesheet for "standards compliant browsers"

and

1 Stylesheet to cater for any issues with the others

If you have more than this, you're creating trouble for yourself and are juat adding to the number of http requests for the page.

like image 83
Fenton Avatar answered Oct 17 '22 01:10

Fenton