Aditya Christianto Aditya Christianto - 1 year ago 42
CSS Question

Is the href="" function the same as include?

I want to ask you something about

in HTML and
in PHP. What is the difference between
, they both refer to a file path? When I type
<link rel='stylesheet' href='style/style1.css' />
it means that "you can find
file at folder named
at your current position and so on for the include. If you can be more specific I will appreciated it.

Answer Source

href is not a file path, it's a URL, you use it to direct to another page.

include in PHP actually includes a separate file at that point in the page. Let's say you're building a php flat file site. Your header and footer are always the same but the pages change. You could include the header and footer as separate files instead of typing their code into each page.

  include 'header.php';
  //the rest of your page code goes here.
  include 'footer.php';