Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Randy_Johnson's avatar

ReactJS InertiaJS Tailwind Image as Background Cover

Hey, inertiajs how am I get to get a back ground to cover for that individual page. I have tried two ways without success

	<div className="h-screen">
                <div className="bg-[url('storage/imgs/front-page/bg-2.png')] bg-hero bg-no-repeat bg-cover bg-center bg-fixed">
</div>
</div>

The above displays the bg but it doesn't cover the page, only covering if their is content filling the height.

.welcome-background {
    background-image: url("storage/imgs/front-page/bg-2.png");
    background-repeat: no-repeat;
    background-position: right top;
    background-attachment: fixed;
}
0 likes
3 replies
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

You need to give it full height as well. Try h-full or h-screen on the child div

1 like
Randy_Johnson's avatar
<div className="min-h-screen bg-[url('storage/imgs/front-page/bg.png')] bg-hero bg-no-repeat bg-cover bg-center bg-fixed"></div>
azimidev's avatar

Also

background-position: right top;

should be

background-position: center;

and <div className="welcome-background h-screen">

Please or to participate in this conversation.