I have an outer div with relative position, inside it I have a inner div with absolute position, because I want the inner div sticking to the bottom of the outer div (bottom: 0).
Now how to center align a button inside the inner div?
JSX:
<Card>
<CardTitle>{voucher.voucherTitle}</CardTitle>
<CardContent>{voucher.voucherDesc}</CardContent>
<CardFooter>
<RedeemBtn>{`Redeem`}</RedeemBtn>
</CardFooter>
</Card>
Styled components:
const Card = styled.div`
width: 312px;
max-width: 100%;
height: 200px;
box-sizing: border-box;
justify-content: center;
background-image: linear-gradient(#fff calc(100% - 50px),hsla(0,0%,93.3%,.4));
`
const CardFooter = styled.div`
position: absolute;
bottom: 0;
color: #e40000;
width: 100%;
align-content: center;
`
const RedeemBtn = styled.button`
margin: 0 auto;
`