How to organize stylesheets [closed]


I'm doing a web application and I just made a form, but I found myself a question, how do I organize the style sheets, at the moment I have a single style sheet called sytle.css, so for the other pages of the site, I must enter my styles in that same file or create another for each specific page, as it is the most advisable way to structure the .css files, thank you very much for the contribution.

asked by julian salas 20.02.2016 в 16:49

1 answer


If your application is simple and the styles you apply are quite similar on all pages then you can keep the styles in a single .css file


  • You make a single request to the server with what you leave free to make other connections


  • If the styles vary a lot from page to page, each time the styles are loaded you will be bringing more than necessary

If your application is more complex, you have a lot of styles and you want to separate the code better you could also separate it into at least one file with the common styles, and another file with the specific styles of a group of similar pages.


  • Better organization of the code
  • The total weight decreases when bringing only what is necessary


  • You are going to make 2 or more requests (simultaneous connections are limited) so the loading time of the page could increase

The topic of optimization is complex, there are many additional factors to take into account:

  • Client side cache for static .css, and server side if for example they are dynamically generated or compiled with LESS or SASS

The suggestion I give you is the following:


Start with what is easiest for you in development time, that is, how you feel better organized depending on your project, and then measure the performance and improve it according to your own tests.

answered by 20.02.2016 в 18:11