Guys this is my folder structure
Project
css
style.css
js
javascript.js
image
background.jpeg
style.css
body{
background-image: url("image\background.jpeg");
}
index.php
<html>
<head>
<title>Todo Application</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<div id = "header">
hiuiiiii
</div>
</body>
</html>
So guys tell me where am i wrong such that i can correct it so that my background image is displayed.
I believe this is the issue.
Incorrect - url("image\background.jpeg");
Correct - url("../image/background.jpg");
../
- This means one directory up to give the image location, as in your case, it is inside image directory.
Hope this helps.
It should look like this:
body {
background-image: url("../image/background.jpeg"); }
That is a really common mistake, even with me. You need the double dots to go back one folder, since your stylesheet is inside the css folder and your background is inside the images folder. Also, once you get that fixed, you could perfectly align it in the back using
background-size: cover
;
.. and with the prefixes, it would look like this.
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
I hope this answers your question.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With