I am coding a web site in html and css and learning as I go. I wondered what would be the best way of using CSS. Would it be to have a style sheet for each page of html or ONE style sheet for the entire website?
The reason that I ask is that each page of my website may end up with different design elements and I really feared one BIG style sheet and thought that individual style sheets would make future updating a simpler task?
What do you think? Help and advice is much appreciated,
You could start with a general one for the entire web site and add additional stylesheets to use on specific groups of pages that require additional formatting. These additional stylesheets can then @import the general one first to provide the bulk of the styling.
if you are able to divide the class and div according to use you can easily clear the unused css and finally when your site is ready you can use the css tidy and reduce the file size for the production purpose.
I generally use one style sheet to avoid multiple HTTP requests. What you can then do is load other style sheets dynamically if they are needed on a particular page.
You could set up a script that looks for a particular class or id. If it’s found on that page, load those styles.
That way you do not load unnecessary css when it isn’t used.
what about dividing the css according to use like separating the css for fonts and its style and layout In that way you can reuse the css and there will be no confusion too