分裂与下面的内容流血?

时间:2014-09-25 15:54:56

标签: html css background z-index obscured-view

this page右上角,我们可以看到我创建的按钮“现在就问一个问题”。我设置了背景颜色,背景图像和高Z-Index,然而,下面的文字仍在通过它进行放血。

如何阻止这个?我不知道如何解决这个问题,甚至不知道为什么会这样......

 <div class="clearfix grpelem" id="u181-4"><!-- content -->
<style>
    #ContactButton {
        margin-bottom: 5px;
    }

    #ContactButtonContainer {
        margin-top: -50px;
        position: relative;
    }

    #ContactFormContainer {
        width: 250px;
        height: 160px;
        border: 1px solid black;
        position: absolute;
        top: -5px;
        left: -52px;
        z-index: 1001;
        background-color: #fff;
        background-image: url("images/formbg.jpg");
        background-repeat: repeat;
    }
</style>
<script>
    function ToggleContactFormContainer() {
        var FormContainer = document.getElementById("ContactFormContainer");

        if(FormContainer.style.display == "none") {
            FormContainer.style.display = "block";
        }
        else {
            FormContainer.style.display = "none";
        }
    }
</script>
  <p id="ContactButtonContainer"><img src="images/ContactButton.jpg" id="ContactButton" onclick="ToggleContactFormContainer()"><br><b>CALL US TODAY (219) 221-6500</b>&nbsp;&nbsp;</p>
  <div id="ContactFormContainer" style="display: none;">
    Test
  </div>
 </div>

1 个答案:

答案 0 :(得分:1)

问题是#u181-4元素的z-index为6,联系表格在其中;它限制了表单相对于整个页面的z顺序。

除非#u181-4需要有z-index,否则只需将其保留为auto即可正常工作。