Is it feasible to position elements in relation to the ancestors of their parents?
<div id='div1'>
<div id='div2'>
<input type='button' class='btn'> button 2</button>
<input type='button' class='btn'> button 3</button>
<input type='button' class='btn'> button 1</button>
</div>
</div>
The desired CSS objective is to align the buttons vertically centered to the first div. Here is the CSS I attempted:
.btn{
position: relative;
top: 50%;
transform: translateY(-50%)
}
However, this code centers the buttons relative to the second div which has different dimensions compared to the parent div. Is there a way to achieve this?