I'm trying to create a header that uses a webp image as background if the browser allows it, but when not I want the browser to load a png instead.
this is the HTML I have
<div class="no-webp">
<section class="section-hero box-container">
<div class="container">
<div class="row">
<div class="col-12 hero-bg">
</div>
</div>
</div>
</section>
</div>
<div class="webp">
<section class="section-hero box-container">
<div class="container">
<div class="row">
<div class="col-12 hero-bg">
</div>
</div>
</div>
</section>
</div>
and this is the CSS I have so far:
section.section-hero{
background-position: center;
background-repeat: no-repeat;
background-size: cover;
height: 296px;
}
.webp section.section-hero {
background-image: url(/coe/julio-rodriguez/proyecto/public/img/webp/hero-banner.webp);
}
.no-webp section.section-hero {
background-image: url(/coe/julio-rodriguez/proyecto/public/img/webp/hero-banner.png);
}
but I can't figure out how to link everything together, any idea?