Should I combine .css files with php to reduce HTTP requests?

I thought today when I linked the web page to 3 external .css files: "This is too many HTTP requests!" I need to know if I should use php to merge these files into one? Or should I just import all three in <head>with tags <style>? I found one relevant link to interwebs: Six CSS or JavaScript files to shorten HTTP requests , but I don't think this gives an adequate discussion.

note: I mark this for javascript because I believe this also applies to .js files, so please note if your answer only applies to CSS or javascript

+3
source share
3 answers

I think this is not necessary. The browser will download both files only once. If you add them to the style tag on the page, it will load the same content every time this page is loaded.

If your page / site does not have a lot of access per second, you will not need it.

What I think...

+3
source

I need to know if php should be used to merge these files into one?

Often yes, not only because of the number of HTTP requests (which usually happen only once in any case), but also because Internet Explorer cannot deal with more than 31 external stylesheets on one page .

, PHP CSS. .

?

: .

+3

, css js .

, .

, main.css

@media screen {
    p { [styles] }
    ...
}
@media print {
    p { [styles] }
    ...
}

body:
http://misteroneill.com/improved-internet-explorer-targeting-through-body-classes/

0

Source: https://habr.com/ru/post/1757036/


All Articles