Reputation: 3
I am learning web design and i have a very simple issue that i haven't been able to find an answer to. I created a very simple page for an example and both documents are in the same folder. it works as a snippet on here, but then it doesn't work on my computer. I have checked the filepath for the stylesheet several times, but it doesn't work. If anyone can help that would be very appreciated. Thanks! (im not sure if the snippet is useful but i thought i would include it anyways)
body {
background-color: #eee;
}
#header {
background-color: #66CCFF;
color: white;
}
<div id="container">
<div id="header">
<h1>text</h1>
</div>
<div id="content">
<div id="nav">
<h3>nav</h3>
<ul>
<li>home</li>
<li>about</li>
<li>contact</li>
</ul>
</div>
<div id="main">
<h2> other text </h2>
</div>
</div>
</div>
Upvotes: 0
Views: 54
Reputation: 903
Just remember to follow this, to avoid again issue in case of accessing through parent directory:
parent folder:
<link rel="stylesheet" type="text/css" href="../style.css" />
same folder:
<link rel="stylesheet" type="text/css" href="./style.css" />
Upvotes: 1
Reputation: 106
This mainly has to do with the path of the file. Try this:
href="./style.css"
If that doesn't work show us the error you get
Upvotes: 1