Here I was trying to set the parent height
as how much height of children, but something is failing.
#parent {
background-color: red;
}
#child {
background: blue;
}
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
<div id="parent" style="clear: both; z-index:2;padding: 1rem 1rem;border-radius: 1.25rem;" class="py-2 shadow">
<div id="child" class="d-flex justify-content-center position-absolute">
child
</div>
</div>