Kevinh56 Kevinh56 - 2 months ago 5
CSS Question

My stylesheet will not link with my html

I put the link into all of my html pages and my css only shows up on my first page but none of the others.

<title>Angels Drawings</title>
<link rel="stylesheet" href="style.css">

<li><a href="Pages/Page2.html">Page 2</a></li>
<li><a href="Pages/Page3.html">Page 3</a></li>
<h2>This is her website</h2>
<p>And this is all the info</p>



The other pages (Page2.html and Page3.html) are inside the "Pages" directory. You cannot use the same url for the css because it is a relative path. That means it will try to find the css into the "Pages" directory, and it will fail because it doesn't exist.

Answer updated after discussing the real use case with the OP.

In the Angelswebsite.html use the following:

<link rel="stylesheet" href="style.css">

In all pages inside the Pages subdirectory use the following:

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