Grid alignment inconsistency

Hello. I have 4 cards in a grid. As you can see in the image, the 2nd one got a little bigger due to the extra line. To remove the consistency, I am hoping to make other cards extend as well but I am unable to. Please guide me. Code:
function PeoplesGrid() {
const peoplesData: PeopleData[] = [ ... ];

return (
<div className="grid grid-cols-4 gap-3 mt-18">
{peoplesData.map((person) => (
<div key={person.title} className="flex flex-col">
<img src={person.image} alt="" />

<div className="bg-neutral-950 flex gap-x-4 p-5">
<img src={person.icon} alt="" className="size-7" />
<div>
<p className="text-lg font-medium text-white">{person.title}</p>
<p className="text-neutral-400 mt-1">{person.description}</p>
</div>
</div>
</div>
))}
</div>
);
}
function PeoplesGrid() {
const peoplesData: PeopleData[] = [ ... ];

return (
<div className="grid grid-cols-4 gap-3 mt-18">
{peoplesData.map((person) => (
<div key={person.title} className="flex flex-col">
<img src={person.image} alt="" />

<div className="bg-neutral-950 flex gap-x-4 p-5">
<img src={person.icon} alt="" className="size-7" />
<div>
<p className="text-lg font-medium text-white">{person.title}</p>
<p className="text-neutral-400 mt-1">{person.description}</p>
</div>
</div>
</div>
))}
</div>
);
}
No description
16 Replies
ἔρως
ἔρως3mo ago
you have to do the tailwind equivalent of grid-template-rows: 1fr
Shayokh
ShayokhOP3mo ago
You mean grid-rows-1?
.grid-rows-1 {
grid-template-rows: repeat(1, minmax(0, 1fr));
}
.grid-rows-1 {
grid-template-rows: repeat(1, minmax(0, 1fr));
}
ἔρως
ἔρως3mo ago
i have absolutely no idea but looks like it
Shayokh
ShayokhOP3mo ago
Nope same result
ἔρως
ἔρως3mo ago
where did you put it?
Shayokh
ShayokhOP3mo ago
<div className="grid grid-cols-4 gap-3 mt-18"> Here
ἔρως
ἔρως3mo ago
and which element has the background?
Shayokh
ShayokhOP3mo ago
Background? This is the code
ἔρως
ἔρως3mo ago
yes, the black background
Shayokh
ShayokhOP3mo ago
<div className="bg-neutral-950 flex gap-x-4 p-5"> Right below the image
ἔρως
ἔρως3mo ago
how about you set it on the parent? on the first div inside the map?
Shayokh
ShayokhOP3mo ago
Never mind
flex-1
flex-1
did the job
ἔρως
ἔρως3mo ago
where?
Shayokh
ShayokhOP3mo ago
<div className="bg-neutral-950 flex flex-1 gap-x-4 p-5">
Shayokh
ShayokhOP3mo ago
No description
ἔρως
ἔρως3mo ago
now the question is "why it works?" 🤔

Did you find this page helpful?