html - Should I work with one main CSS file or separate files for each page? -


i want create website more 1 page bad not write basic layout(header menu footer) css every page.

i want create base layout "main.css" , content different css;

<!--main (base layout)--> <link rel="stylesheet" type="text/css" href="main.css"> <!--home (css home)--> <link rel="stylesheet" type="text/css" href="home.css"> 

so question, way work or isn't way work. ask because don't want learn self bad method.

this not bad method @ all. makes development easier readability , organization, having separate pages , forth in different css files may work better, when you're finished should combine them 1 less http requests, optimizing page speed/load times.

there practices can use:

  • put of global css files (css used on every page) 1 file, opposed duplicating them throughout.
  • inline css page-specific , won't used anywhere else.
  • compress css

here great tools can use test pagespeed while developing, you'll learn many great tips on how optimize code, images, , forth great user-friendly website:

  1. gtmetrix
  2. google pagespeed tools

Comments