I'm a complete beginner of html/css.
I use PHP to include the same head section in different webpages. There is a href link in the head section linking to an external css. file which styles the layout of multiple webpages.
Since the different webpages locate in different subfolders in the root folder, I have to use the absolute path to link the css. file, and here comes the problem: I don't know how to write it correctly.
When I use relative path for each individual webpage, the link works fine, but when I tried to use the absolute path, it simply doesn't work.
I have tried:
1.href="file:///C:\xampp\htdocs\root\styles\style.css"
2.href="file:///C:/xampp/htdocs/root/styles/style.css"
3.href="file://C:/xampp/htdocs/root/styles/style.css"
4.href="C:/xampp/htdocs/root/styles/style.css"
5.href="c:/xampp/htdocs/root/styles/style.css"
Here is the beginning part of the code:
<!DOCTYPE html>
<html lang="en">
<head>
<?php include('common/head.php') ?>
<title>Home</title>
</head>
and this is the head section:
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="file:///C:\xampp\htdocs\root\styles\style.css">