I’m working on a grid layout using Tailwind CSS (v4.1).
Visit this play snippet
https://play.tailwindcss.com/cAvvS656Ts
Here’s a minimal example:
<script src="https://unpkg.com/@tailwindcss/browser@4"></script>
<style type="text/tailwindcss">
@utility border-line-1 {
content: "";
width: 100vw;
height: 2px;
background-color: red;
position: absolute;
bottom: 0;
left: 0;
}
</style>
<body class="bg-gray-800">
<section class=" h-[100vh] w-full bg-gray-900 p-4 text-white">
<div class=" grid grid-cols-4 grid-rows-6 gap-5">
<div class="row-span-6 border border-white">A</div>
<div class="relative col-span-2 border border-white after:border-line-1">B</div>
<div class="row-span-6 border border-white">C</div>
<div class="row-span-4 border border-white">D</div>
<div class="row-span-4 border border-white">E</div>
<div class="col-span-2 border border-white">F</div>
</div>
</section>
</body>
What I want
The red line should start from the beginning of section A (so basically from the very left edge of the grid container).
It should span the entire width (A → B → C).
It should sit exactly at the bottom of B.
What happens now
Since the pseudo-element is inside B, it only positions relative to B. If I hack it with left:-180px, it looks close to what I want — but that’s not responsive or correct.
Question
How can I properly make this red line span the full width of the grid container but align with the bottom of B without hardcoding offsets?
Note
This is purely a CSS positioning issue — I’m just using Tailwind classes to generate the CSS, so I added the tailwind-css tag as well.