I currently have a css file that I want to link in visual studio. I have included the file in my project yet it is still not working.
I am simply using css to change the body background. Here is my code:
Css – folder: /css/Style.css:
body
{
background-image: url('Images/body-background.jpg');
background-repeat: repeat-x;
}
Html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My Website</title>
<link rel="stylesheet" type="text/css" href="css/Style.css" />
</head>
<body>
<div id="header">
</div>
<div id="page-wrap">
<ul id="nav">
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
<li><a href="#">Link</a></li>
</ul>
<p>Main Content</p>
</div>
<div id="footer">
</div>
</body>
</html>
It all works perfectly when I put the style internally in the head it works perfectly. What’s going on?
The link in the css file to your image is relative to the css file.
try
to get it from root, or
to get it relative to the css file.