Failed to add bg image to css file

Just, I'm trying to add a background image to css code.

body {
    line-height: 1;
    background-image:url(../img/bg1.jpg);
}

But the background image does not appear during testing with localhost / foldername / index.php

Interestingly, I can edit the background color ( background-color:#993).

My folder tree looks like this;

+Main Folder
  +css
     style.css
  +img
     bg1.jpg

Could you help me why I cannot add a background image to the css body.

+4
source share
3 answers

You may be missing ''around the url.

body {
    line-height: 1;
    background-image: url('../img/bg1.jpg');
}

In addition, there may be no repetition.

body {
    line-height: 1;
    background-image: url('../img/bg1.jpg');
    background-repeat: repeat;
}
+3
source

, css , . link , css:

<link rel="stylesheet" href="/css/style.css" />
0

background: url(' Your Path ')

background-image: url(' Path ')
-1

All Articles