I have this Register button that needs to be positioned at the bottom of the card, but somehow using position absolute (bottom: 0) places it into the bottom of the main (first) div. Not sure what to do to place it at the bottom of the card:
<STYle>
.cardHorizontal {
cursor: default;
display:inline-block;
transition: 0.3s;
width: 40%;
margin-right: 20px;
}
</STYle>
<div style="height: 2000px; background-color: #F8F6F7;">
<div style="margin-left: 20px;">
<br><br>
<!-- Card #1 -->
<div class="cardHorizontal" style="width: 290px;">
<a href="#" target="_blank">
<img src="https://www.jquery-az.com/html/images/banana.jpg" style="width:50%; border-radius: 20px; margin: auto; display:block;">
</a>
<div class="container">
<h3><b>Card Title</b></h3>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum interdum bibendum arcu quis molestie. Duis at pretium justo, at egestas leo. Quisque gravida, est sit amet blandit sagittis, lorem sem iaculis diam, nec facilisis mauris arcu quis orci. Etiam eget ullamcorper ipsum. Maecenas eu nulla ac quam aliquet bibendum vitae vitae est.</p>
<p style="font-size: 16px"><b>Date: January 2050</b></p>
<a href="#">Read More</a>
</div>
<button style="background-color: #6D925C; color: white; height: 50px; width: 150px; padding: 0; border: none;" type="button">Register</button>
</div>
</div>
</div>
Any suggestion?
Thanks
3
Answers
This will position the button absolutely at the bottom of its parent element, which is the .cardHorizontal div.
Looks like the button is outside the card container, so the absolute position is not working as intended. You can try to wrap the button inside the container where the rest of the card’s content is, and then use the position properties to position it at the bottom.
Now, the
registerButton
class gives the button an absolute position at the bottom of the card. By addingposition: relative;
to thecardHorizontal
class, the button will be positioned at the bottom of that card.