我有一些文本样式与css显示:网页顶部的inline-block属性。我使用了这个属性,因为它完成了我想要的布局目标。 (实际代码比下面的内容复杂一点,块元素使其能够正确显示。)
但是,我现在已经为下拉菜单添加了一些javascript和css,它应该覆盖在下面的页面上。它覆盖了下面的页面,除了上面显示的内联块元素。
任何人都可以提出一种方法来覆盖这个元素。
这是我目前的代码。
标题中的javascript和css
<style type="text/css">
#results {display: block;
padding: 4px;
position:absolute;
text-align:left;
border-top-style:none;
background-color:white;
opacity:1.0;
filter:alpha(opacity=100);
}
.username {
position:relative;
display: inline-block;
}
</style>
function search() {
//retrieve input from webpage
document.getElementById("results").innerHTML=xmlhttp.responseText; //populate results div
//ajax to get resposetext from serve
}
HTML
<table>
<tr>
<td>
<input type="text" onkeyup="searh(this.value)">
<div id="results" style="position:absolute"></div>
<div class="username">Username</div>
</td>
</tr>
</table>
答案 0 :(得分:1)
尝试将z-index
设置为下拉到较高的值,例如9999