community,
I have a quick question. I am using the current version of Tailwind CSS.
My goal was to send the button (corpus delicti) to the bottom of the parent div. I was using content-between the whole time but that didn't work.
So I tried just for fun justify-between and the button element was sent to the bottom of the parent div. I don't get it. Why is that?
In CSS docs it is stated that "
...The CSS justify-content property defines how the browser distributes space between and around content items along the main-axis of a flex container [...]."
Here is the CSS code:
<div >
<div id="parent-div" >
<div >
<h1 >foo</h1>
<p >bar</p>
<p >hoo</p>
</div>
<div >
<button >corpus delicti</button>
</div>
</div>
<div >
<img src="../static/pics/gif.gif">
</div>
</div>
Would be very glad to get an answer, since that behavior totally destroys my very hard-earned trust in CSS.
THX in advance!
CodePudding user response:
Get rid of flex-col on #parent-div and use h-fit (height: fit-content;) on your button.
See here
<div >
<div id="parent-div" >
<div >
<h1 >foo</h1>
<p >bar</p>
<p >hoo</p>
</div>
<div >
<button >corpus delicti</button>
</div>
</div>
<div >
<img src="../static/pics/gif.gif">
</div>
</div>

