nav {
height: 10em;
}
.some_text {
top: 50%;
left: 40%;
position: relative;
}
<nav>
<a class="some_text">ABC</a>
</nav>
as per https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Values_and_units#percentages
Since nav
parent is body
which has no property defined, shouldn’t nav also default to undeterministic properties meaning values which browser cannot use , and not move some_text
down the browser?
2
Answers
It’s because you have given a height of
50em
to yournav
element. Try removing that.At present, at least two reasons can be foreseeable:
height: 50em
);top: 50%
).Solutions/Hints:
border: 1px solid #0ff;
under the lineheight: 50em;
for clarity.