Peter Jones February 2016

how to get background image present in other folder with css?

Guys this is my folder structure

Project

index.php 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.

Answers


Alon Eitan February 2016

change background-image: url("image\background.jpeg"); to background-image: url("../image/background.jpeg");


alexta96 February 2016

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.

Post Status

Asked in February 2016
Viewed 1,649 times
Voted 10
Answered 2 times

Search




Leave an answer