0

I have some text styled with the css display:inline-block attribute at the top of a webpage. I used this attribute because it accomplishes the layout goal I want. (The actual code is a bit more complicated than below and the block element enabled it to display properly.)

However, I have now added some javascript and css for a dropdown menu that is supposed to cover over the page underneath. It covers the page underneath except for the above inline-block element that shows through.

Can anyone suggest a way to cover over this element as well.

Here is code I have currently.

javascript and css in header

<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>
ultranaut
  • 2,132
  • 1
  • 17
  • 22
user1260310
  • 2,229
  • 9
  • 49
  • 67

1 Answers1

1

Try setting z-index for the drop down to a high value, like 9999

fredrik
  • 13,282
  • 4
  • 35
  • 52