Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use more than one CSS sheet?

Tags:

css

I am updating a website to add some mobile friendly pages.

At the moment we have one big css page with everything in. My idea is to put all the mobile specific css into a separate file and then link both sheets. The mobile css will overide anything in the default css (bigger buttons etc).

Im quite new to css, what is the best practice?

like image 616
Robert Avatar asked May 20 '10 13:05

Robert


People also ask

Is it better to have one or multiple CSS files?

A web app with different rather “siloed” sections probably need two CSS files. One global with the most common design patterns and then a section-specific CSS file with the less common design patterns that section needs. Sites with many vastly different styles of pages likely need two stylesheets.

Should you use multiple CSS style sheets?

Yes, you can apply more than one stylesheet to an HTML file. For each stylesheet you link to a page, you would just need to add an additional <link> element.

How many CSS pages should I have?

you should keep only one css file.

Should I separate my CSS files?

There is no need to export all styles at once; this saves time while also making maintenance simpler. If your project is large, you should split it. To have at least one hyperlink tag for each CSS file is the same. Easily customize your CSS files to suit your style.


1 Answers

One large CSS file leads to fewer HTTP requests, which can improve performance.

Several smaller files leads to easier organization which will make development and maintenance cheaper and easier.

like image 171
AaronSieb Avatar answered Sep 28 '22 03:09

AaronSieb