Home > OS >  CSS background image are not showing up
CSS background image are not showing up

Time:07-02

Why the css background image not showing up? I checked the image location are correct.

The HTML Code:

<section id="hero-image">
  <h1>paper</h1>
</section>

The CSS Code:

.hero-image{
    background-image: url(img/Slideshow/slide.png);
    background-position: center;
    background-repeat: no-repeat;
    background-size: cover;
    position: relative;
}

CodePudding user response:

In your CSS code, try changing the .hero-image to #hero-image. This is because you have defined "hero-image" as an ID. And you use #hero-image when searching for an ID within your HTML.

  •  Tags:  
  • css
  • Related