I am wondering how i can center absolute element inside container, but without changing position of childs elements inside centered element. *Child elements are absolute too.
I simply want to center the '#ground' both, vertically and horizontally inside container, without moving any child inside '#ground', is it do-able?
#container {
display: grid;
width: 150px;
height: 150px;
background: black;
}
#ground {
position: absolute;
width: 100px;
height: 100px;
background: red;
}
.tile {
position: absolute;
width: 30px;
height: 30px;
background: aqua;
top: 20px;
left: 50px;
}
<div id="container">
<div id="ground">
<div class="tile"></div>
</div>
</div>