要素があり、要素に割り当てtop: -100%
ました。top: -100%
に翻訳する必要がありますtop: -{height-of-the-element}
。しかし、私が得ているのはtop: -{height-of-another-element-wrapping-it}
.
HTML と CSS を説明するコードを次に示します (非常に複雑なので、完全なコードではありません)。
<nav>
<section>
<ul>
<li>
<ul class="i-want-to-use-top-here"></ul>
</li>
</ul>
</section>
</nav>
nav {
height: 60px;
}
.i-want-to-use-top-here {
height: 200px;
position: absolute;
top: -100%;
}
なぜこのようなことが起こっているのですか?で使用する要素の高さの -100% を取得するにはどうすればよいtop
ですか?