Next.js Discord

Discord Forum

backgroundImage; is there a better method?

Unanswered
Asiatic Lion posted this in #help-forum
Open in Discord
Asiatic LionOP
[QUESTION PORTION]
Currently I am loading my backgroundImage like so, but it's a bit slow on first page load. Is there a better way of doing this in nextjs?

 <div className="[other styling] bg-cover bg-center bg-fixed relative" style={{ backgroundImage: "url('/bg.jpg')" }}>


[BUG PORTION]

I also noticed when I open the app on my phone (after pushing to vercel) it only loads the top 1/10th or so of the background image instead of the entire image like when resizing the developer tools. Am I doing something wrong with the bg- values?

3 Replies

Netherland Dwarf
You can use next image comp
With fill prop
Position Absolute