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?
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.
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.
you should keep only one css file.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With