skip to Main Content

The problem is that I have a div class ‘breadcam_bg’ with a url of an image. And in my console, page sees the div, but does not display image

html

    <div class="bradcam_area breadcam_bg">  This div!
        <div class="container">
            <div class="row">
                <div class="col-xl-12">
                    <div class="bradcam_text">
                        <h3>Contact</h3>
                    </div>
                </div>
            </div>
        </div>
    </div>

style.css

.breadcam_bg {
  background-image: url(blog/static/blog/img/banner/banner.png);
}

_bradcam.scss

.breadcam_bg{
    background-image: url(blog/static/blog/img/banner/banner.png);
}

I guess the url is correct, so I have no idea what is the problem about

2

Answers


  1. The URL to the image must be written in "".

    .breadcam_bg {
      background-image: url("blog/static/blog/img/banner/banner.png");
    }
    

    should work then, otherwise you should check if the url is correct and if the page can access the image

    Login or Signup to reply.
  2. I tried your code on my system with my own image it seems to work fine for me
    I think the issue is with the url try putting the root url

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>
    <style>
        .breadcam_bg {
      background-image: url("https://i.pinimg.com/564x/20/0c/54/200c54a0baafda5d7f2395da28ec3e97.jpg");
    }
    </style>
    <body>
        <div class="bradcam_area breadcam_bg">  This div!
            <div class="container">
                <div class="row">
                    <div class="col-xl-12">
                        <div class="bradcam_text">
                            <h3>Contact</h3>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
    </html>
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search