前端 - CSS绝对定位容器的位置始终盖在相对定位容器的上面?
PHP中文网
PHP中文网 2017-04-17 11:33:31
0
5
652

下拉列表是绝对定位的。但是请输入验证码的容器是相对定位的,以为你里面有个获取验证码的按钮要用绝对定位。 所以导致了相对定位的容器 始终盖住了绝对定位的下拉列表。 有人能出出主意么。更新。设置绝对定位的index没有效果,设置相对定位的index为-1的话,里面的输入框不能输入了。

PHP中文网
PHP中文网

认证0级讲师

reply all(5)
黄舟

Floating elements (position) are compared at the same level. The one with a larger z-index value will be displayed in front. What is the same level? Let’s explain it through the code below.

<p class="block1"></p>
<p class="block2">
    <p class="block3"></p>
    <p class="block4"></p>
</p>

Assume that the elements here are all floating elements. It can be seen here that block1 and block2 are at the same level. block3 and block4 are at the same level. We cannot combine block1 and block3 Perform z-index value comparison, which is meaningless.

巴扎黑

As long as the z-index of absolute positioning is larger than the z-index of relative positioning!

洪涛

Is zIndex set?

刘奇

Set the z-index of the container

左手右手慢动作

Sometimes elements with relative or absolute position in the HTML will block the elements in the front. You can check if this is the reason

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template