简体   繁体   English

z-index属性不起作用

[英]z-index property does not work

I want to set that in put textbox 's location on initial condition header div . 我想在初始条件标题div上的in put textbox的位置中进行设置。 But that textbox is getting hidden under initial condition div. 但是该文本框在初始条件div下被隐藏了。 Are there any alternative to z-index . z-index是否有替代方法 I have attached my css also. 我也附上了CSS。

HTML: HTML:

<div id="initialCondHdr" class="initialCondHdr">Demo Experiment</div>
<div id="archiveTable_filter" class="dataTables_filter">
    <label>
        <input type="text" placeholder="Search" style="width:220px;height:30px;" />
    </label>
</div>

CSS: CSS:

#initialCondHdr {
    color:#043751;
    font-family:calibri;
    font-size:19px;
    line-height:42px;
    position:relative;
    text-indent:15px;
}
.dataTables_filter {
    float: left;
    left: 119px;
    margin: 12px 0 22px 12px;
    overflow: hidden;
    position: absolute;
    text-align: right;
    top: -20px;
    z-index: 5;
}

It's not entirely clear to me what you are trying to do but I think you are trying to lay the input on top of the first div. 对我来说,您目前想做的还不是很清楚,但我认为您正在尝试将输入内容放在第一个div的顶部。

That being the case, you will have to change the HTML structure and adjust the positioning of your input as follows: 在这种情况下,您将必须更改HTML结构并按以下方式调整输入的位置:

JSfiddle Demo JSfiddle演示

Revised HTML 修改后的HTML

<div id="initialCondHdr" class="initialCondHdr">Demo Experiment
    <div id="archiveTable_filter" class="dataTables_filter">
        <label>
            <input type="text" placeholder="Search" style="width:220px;height:30px;"/>
        </label>
    </div>
</div>

Revised CSS 修订的CSS

  #initialCondHdr{
        color:#043751;
        font-family:calibri;
        font-size:19px;
        line-height:42px;
        position:relative;
        text-indent:15px;
        color:red; /* visual reference only */
}
    .dataTables_filter{
        overflow: hidden;
        position: absolute;
        opacity:0.5; /* visual reference only */
        top:0;
        text-align: right;
        z-index: 1;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM