Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Page specific CSS styling, but where to put the code?

Tags:

css

header

Apart from the global.css i'm including in my header.php, i would also like to load certain page-content specific styles.

But since my <head></head> is already covered by my header file, and i don't wish to resort to inlines, what is the best way to place the styles on the specific page?

Thanks ! :D

like image 873
n a Avatar asked Feb 28 '23 02:02

n a


1 Answers

I would try one of the following:

  1. Break the header.php in 2 distinct files to allow any pages including it to add their own link tags
  2. At the top of the file, before including header.php, set an array like $included_css containing styles (style1.css, style2.css). Then in header.php you can do a simple foreach and include them after global.css (to allow them to take precedence)
like image 95
nc3b Avatar answered Mar 04 '23 20:03

nc3b