Reputation: 21
Am I typing something in wrong for the background image not to be working? All the folders and files are in the correct spot for it to work.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>First Project</title>
<link rel="stylesheet" href="css.folder/first_project.css">
</head>
<body>
<h1>marvelous day</h1>
</body>
</html>
h1 {
color: blue;
}
body {
background-image: url("img/pattern.png");
}
Upvotes: 0
Views: 42
Reputation: 5058
You can add a slash at the beginning so it starts looking from the root:
background-image: url("/img/pattern.png");
Upvotes: 0
Reputation: 542
I suppose your folder structure is the following
if this is the case in your css you should add ../ before your url so that the browser can know where the image is located
body{
background-image:url("../img/pattern.png");
}
pay attention for relative urls in your css
Upvotes: 1