I am trying to do a component that has 4 fields, two on the right and two on the left, I have them spaced horizontally but I have not been able to do the same vertically.
Here’s the code:
<div class="flex min-h-[5em] bg-blue-500 justify-between">
<div class="flex flex-col h-full justify-between w-full">
<span> Title </span>
<span>Person</span>
</div>
<div class="flex flex-col h-full justify-between">
<span>100</span>
<span> 12/20 </span>
</div>
</div>
I just want to fill the space vertical space between the span
elements.
Thanks
Edit
It seems to be imposible to achieve this the way I want, but it doesn’t have to be using divs like I am here.
I want to have each of the 4 fields on each corner of the container, the reason I dont do it with position absolute is because I want them to have colition with each other so they don’t overlap. It can probably be achieved using a grid
or something like that, if anyone has any ideas I’m all ears.
4
Answers
I was just looking at your code and noticed that there was a small typo in the span tag.
You should use the class mb-2, which adds a margin to the left.
Try this:
Since you do not want to do it manually, use flex-grow:
You have given a min-h, but for justify-between it is unable to get a default height
Give a default height value (h-full in this case)
div class="… min-h-[5em] h-full … justify-between.."
Hope this makes some sense.
set the height to
full
as wellAdd min-height: inherit; to component give the same height as the parent div
Hopefully, this will work