DEV Community

Nick Milillo
Nick Milillo

Posted on

Nuxt3 CSR Background Image Lazy loading

I currently have background images being displayed for my pages from within the CSS. i.e.

.Inner-Page-Banner {
    width: 100%;
    height: auto;
    min-height: 280px;
    background: url(../img/trailer-owners.webp) no-repeat center top;
    margin-top: 85px;
    text-align: center;
}
Enter fullscreen mode Exit fullscreen mode

I'm going through the process of performance optimisation and changing from img to NuxtImg

I've already changed my Background images to web however I'm wanting to know if there is a way to apply NuxtImg to the CSS or whether there is another way I should be doing this.

Thanks

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay