Why does the eyes stand outside of the div and get pushed down?
the eyes keep standing outside of the eyes div even though they are in the same class. why is this happening?
6 Replies
You have this:
and
The outside div has
class="eyes"
and so do both inside divs.
So, you have a top: 250px, that moves the parent down, and then, the inner ones are moved another 250px down from that point.so what can i do about it? How can i make both go down at the same rate and not the other one being pushed down more then the other when i use top:250px
I'd remove
.eyes
from the outer div, but keep it on both of the ones on the inside. If you need to position/move the outer one, give it a different name 🙂so i have done a few changes on my code and im still getting the same type of problem :( what have ı done is i have deleted the face_part div entirely and kept the eyes div instead. Then i wanted to center the eyes div and i have used
position: relative; left: 20%;
but when ı checked again the eyes was still not in the box completely. the updated code: https://codepen.io/SirYido/pen/poBbRxKcause u have left 20% on .eyes
both parents and child's have same class name
both r being offset by 20% towards right
i recommend using different class name for the parent and the childrens
tho u can still work around by deleting the left 20% from .eyes{...} and adding
.eyes:has(.eyes){ left: 20% }
which only targets the parent
u can give the parent a class name such as .eyes-container
which is also more descriptive