html - Using a PHP include for <head> to provide CSS is giving mixed results -


i want use php include section. have index.php , head.html in have usual stuff: title, etc plus link bootstrap cdn, , custom css file.

upon testing, styles bootstrap work fine custom overrides aren't. under impression custom css files automatically override bootstrap? has worked me in past when linking them traditionally on every page of website. however, want use php includes save time.

i've played around order of things (i.e. bootstrap first, custom css first etc), i've tried linking custom css file separately (outside include) can't figure out.

any ideas?

my code below:

index.php

<!doctype html> <html> <head>     <?php include("includes/head.html");?>  </head>  <body>  <div class="jumbotron paral paralsec">     <h1 class="hero-heading display-3 text-dark">some text.</h1> </div>  </body> </html> 

head.html

<meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- above 3 meta tags *must* come first in head; other head content must come *after* these tags -->  <title>site title</title>  <!-- bootstrap cdn below --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/y6pd6fv/vv2hjna6t+vslu6fwyxjcftcephbnj0lyafsxtsjbbfadjzaleqsn6m" crossorigin="anonymous">  <!-- custom css below --> <link rel="stylesheet" type="text/css" href="css/customcss.css">  <!-- font awesome below --> <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">   <!-- google fonts below --> <link rel="stylesheet" type="text/css" href="#"> 

customcss.css (only contains 1 h1 style, testing)

h1 {color: white} 

folder structure:

css (folder)     customcss.css includes (folder)     head.html index.php 

ordering of css files plays less important role people think.

when there multiple rules targeting same thing, specificity important factor. higher specificity wins.

when selectors have equal specificity value, latest rule (last 1 called) 1 gets applied.

there's lot more info on topic here: https://www.smashingmagazine.com/2007/07/css-specificity-things-you-should-know/


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -