.parent-div {
box-sizing: border-box;
min-width: 0px;
padding: 1rem;
min-height: 1px;
margin: 0;
border: solid 1px;
}
.child-div-one {
box-sizing: border-box;
margin: 0;
min-width: 0px;
min-height: 400px;
display: flex;
border: solid 1px;
}
.child-div-one-of-one {
box-sizing: border-box;
margin: 0;
min-width: 0px;
flex: 1 0 calc(18% - 60px);
margin-right: 1rem;
display: flex;
flex-direction: column;
justify-content: space-between;
}
.child-div-one-of-one-of-one {
box-sizing: border-box;
margin: 0;
min-width: 0px;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
-ms-flex-direction: column;
flex-direction: column;
height: 395px; // this is dynamically calculated it can become any value bw 380 and 400px
position: relative;
display: -ms-flexbox;
display: flex;
}
.button-new-one {
display: -ms-inline-flexbox;
display: inline-flex;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
min-width: 120px;
border-radius: 2px;
cursor: pointer;
padding: 6px 16px;
position: absolute;
bottom: 0;
}
.child-div-one-of-two {
box-sizing: border-box;
margin: 0;
min-width: 0px;
-ms-flex: 1 0 82%;
flex: 1 0 82%;
display: -ms-flexbox;
display: flex;
border: solid 1px;
}
.child-div-two {
box-sizing: border-box;
margin: 0;
min-width: 0px;
display: -ms-flexbox;
display: flex;
}
.child-div-two-of-one {
box-sizing: border-box;
min-width: 0px;
margin: 0 auto;
}
<div class='parent-div'>
<div class='child-div-one'>
<div class='child-div-one-of-one'>
<div class='child-div-one-of-one-of-one'>
<button class='button-new-one'>New One</button>
</div>
</div>
<div class='child-div-one-of-two'></div>
</div>
<div class='child-div-two'>
<div class='child-div-two-of-one'>
<button class='button-less'>Less</button>
<button class='button-more'>More</button>
</div>
</div>
</div>
In the above snippet even i have given margin: 0 auto
, but its positioning on the centre of the div, but i want it move exactly centre of the child-div-one-of-two
,
Should i add margin-left
, or i want to centre the button instead of 100% it should be 82%
So basically the less and more buttons should be exactly centre of the above div. Also if the above div gets more content the less and more buttons should move down, how can i achieve these two things
Any help is appreciated