I encountered an interesting issue when trying to position a div element.
To position the child div B inside the parent div A, I have been using relative and absolute positioning. While I know how to align their bottom edges using bottom: 0px, I need to figure out how to align the top of B with the bottom of A, as illustrated in the diagram below.
Is there a CSS solution for achieving this alignment, considering that I cannot predict the height of B? Below is my current CSS code:
The Goal -
HTML -
<div id="a">
<div id="b"> </div>
</div>
CSS -
#a{
position: relative;
}
#b{
position: absolute;
bottom: 0px;
}