search

Home  >  Q&A  >  body text

前端 - CSS绝对定位容器的位置始终盖在相对定位容器的上面?

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

PHP中文网PHP中文网2866 days ago694

reply all(5)I'll reply

  • 黄舟

    黄舟2017-04-17 11:35:31

    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.

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 11:35:31

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

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 11:35:31

    Is zIndex set?

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 11:35:31

    Set the z-index of the container

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 11:35:31

    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

    reply
    0
  • Cancelreply