Center absolute positioned div
If i understood your question then it will work as below.
You can do it in three ways.
No1 - Using position. Apply width 100% to button parent div and apply the button style as bellow.
.buy-btn{
display: inline-block; /* Display inline block */
text-align: center; /* For button text center */
position: absolute; /* Position absolute */
left: 50%; /* Move 50% from left */
bottom: 10px; /* Move 10px from bottom */
transform: translateX(-50%); /* Move button Center position */
}
No2 - Using parent div, apply width 100% to your parent div and remove the postion absolute from button.
.parentDiv {
width: 100%; /* for full width */
text-align: center; /* for child element center */
}
.buy-btn{
display: inline-block; /* Display inline block */
text-align: center; /* For button text center */
}
No3 - Using margin, apply width 100% to your parent div and remove the postion absolute from button.
.parentDiv {
width: 100%; /* for full width */
}
.buy-btn{
display: inline-block; /* Display inline block */
text-align: center; /* For button text center */
margin: 0 auto; /* For button center */
}
/* Replace below css and add position relative to its parent class*/
.buy-btn {
text-align: center;
position: absolute;
bottom: 10px;
left: 50%;
display: inline-block;
transform: translateX(-50%);
}