There are two HTML pages

index.html item.html 

As well as a compiled main.min.css file connected to index.html .

I do not fully understand whether it is necessary to continue writing styles in main.min.css , and then connect it to item.html .
But then it turns out that I pile up main.min.css and the main page will load longer.

Should I connect a separate css file to item.html ?
Just the hat and footer are the same throughout the site.

  • As for me, “loading longer” and CSS is paranoia. Although on the other hand, I have not written one CSS file more than 500 lines (I write line by line) .. upd, I lie, there is one for 600: D - CbIPoK2513
  • One option is to sculpt everything into a general file, the second option is a separate file for each page. Perhaps there are other options. - fedornabilkin

3 answers 3

In my practice, I do this, first there is a common style, for example common.css for the index.htm page, and for example, if the item.htm page connects common.css (without fail) and for it I create item.css so that These styles modify other components, blocks. That is, the main one is there, but for individual pages it will be easier for you to make changes, as if avoiding copy-paste. Quite justified practice

  • and catch the report from GooglePageSpeed ​​for too many files, PROFIT! - DaemonHK

Personally, my opinion.

CSS, if you use the "normal" properties is not so "heavy".
Yes, and do ***.min.css - paranoia .. IMHO.


You can write three CSS:
One for common elements (body, header, footer, input (s), let's say)
The second, separate, for the index.html page,
Well, the third for the item.html page.

Well, then connect to the page for two CSS.


By answer @John , I decided to add ..

I usually make one CSS file for all pages and its content looks like this:

 Стили для элементов, таких как body, заголовки, инпуты, текстзоны и т.п. "Главная страница", т.е. стили для той страницы, которую видит юзер. Стили для других страниц. "Доп. стили" или "фикс стили", такие как фикс инлайнов (clear: both), анимация и т.п. Ну и в самом конце обычно key-frame 

It usually works fine, without any lengthy processing ..
Perhaps because, as I wrote in the comments, I don’t remember to make CSS more than 600 lines (I write line by line).

    If your page is different in some one (several blocks), it won't be too much main.min.css , but + 1 request for the second file will be much harder for the page.

    Keep in the "main / main" file common styles, such as the grid, typography, menus and other elements available on all pages. If there is any unique block on one page - feel free to add this code to the main file, if there is a lot of unique content there - in another item.min.css, for example, to simplify understanding, you can make a separate file on each page and either use @include connect it to the main one, or compile it separately.