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)

Cloudinary image

Video API: manage, encode, and optimize for any device, channel or network condition. Deliver branded video experiences in minutes and get deep engagement insights.

Learn more

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay