Home > database >  Can't find image in CSS
Can't find image in CSS

Time:03-05

I tried to put an image named "books.jpg" on the background of my page but it says that it can't find it!However,I am sure that the link to the image is correct.

    background-image: url('/Users/abdulazizsuleymanov/Desktop/Python/Django/Review-book/books.jpg');
    /*background-color: #cccccc;*/
    width: 100px;
    height: 100px;```[css file][1]


  [1]: https://i.stack.imgur.com/0O1Ff.png

CodePudding user response:

Why don't you put it directly in the same folder? That way you can just use url('./books.jpg')

CodePudding user response:

Partial URLs are interpreted relative to the source of the style sheet, not relative to the document https://www.w3.org/TR/CSS1#url

It's easiest if you just put the image near the css file.

  • Related