HTML / CSS modules - best practice?

I am starting to pull independent HTML snippets into my own files and include them using the PHP keyword include.

I have a CSS file about 1,500 lines long. "I'm considering embedding inline CSS with relevant HTML files.

Of course, leaving the components that are used in different blocks of HTML.

This way I have HTML / CSS modular blocks that I just include on the server using PHP include

Is this the best practice? Yes / no why

+5
source share
3 answers

Browsers cache CSS files ... because of this, loading one large CSS file is not a big deal.

, css . " ", , , CSS () CSS.

+3

CSS HTML , . JS HTML, CSS. , , CSS, -

<link rel="stylesheet" href="path/to/style.css">

. CSS, , , , , .


, include() ing , 15 , 15 CSS. , .

+1

, , :

  • http-gzipped CSS , ?
  • CSS, , ( , YUI Compressor)?
  • CSS , ; , . , ( Google Analytics ), CSS ..
  • PHP, PHP; , .
  • Do you serve media dependent CSS? If so, make sure that the pieces are only serviced as needed (for example, a mobile device may only need mobile units).
+1
source

All Articles