I have a parent div that floats and has a fluid height and width, as part of Foundation's grid layout. With that parent div I have 2 child divs.
I want the content in both child divs to be center aligned and one div to appear at the top of the container, the other at the very bottom of the parent div.
HTML:
<div class="row">
<div class="small-9 columns">
Dynamic amount of content
</div>
<div class="small-3 columns">
<div class="top">
top div with centered text
</div>
<div class="bottom">
bottom div with centered text
</div>
</div>
</div>
Eg: https://jsfiddle.net/3s0rq04c/11/
I have tried using flex, as below, with no luck:
.container{
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
}
.top {
align-self: flex-start;
}
.bottom {
align-self: flex-end;
}
I have also tried using position: absolute; eg:
.container {
text-align: center;
position: relative;
}
.bottom {
position: absolute;
margin-bottom: 5px;
}
This almost works, but the text in the bottom is no longer center aligned.
Would anyone know if this is possible?