After analyzing the provided HTML code
<div class="child-of-body">
This is a text
</div>
and reviewing the accompanying CSS code
.child-of-body {
position: absolute;
top: 10%;
}
I have successfully adjusted the top
value for the specified elements.
Upon further examination, I noticed that the 10%
calculation is based on the height of the parent element.
My question now is how to set the top
property in percentage values relative to the width of the parent element?
Although I am aware this can be achieved using JavaScript, I am curious if there is a CSS-only solution available.