How do I make a div that "floats" above all the other content in HTML with CSS?

css, html, javascript

Solution

Please refer the example below:

<div class="container">
    <div class="floating">Floating Div</div>
    <div>
        <p>Para Text Goes Here</p>
        <p>More Text</p>
    </div>
</div>

here is your CSS:

.container {
    border: 1px solid #DDDDDD;
    width: 200px;
    height: 200px;
    position:relative;
}
.floating {
    float: left;
    position: absolute;
    left: 0px;
    top: 0px;
    background-color: grey;
}

Things to do:

The use of POSITION:RELATIVE on container and POSITION:ABSOLUTE on floating div

please have a look at the working example : http://jsfiddle.net/tH84L/

Hope it works for you!

Problem

I want to make a div, that pops up when the user hovers on a specific object with JS. I know all that. But my problem is, that the div is within the text and makes everything ugly when it pops up. I want it to float above the text. Is that possible with CSS? If not, is it possible with a plugin or a scripting language?

Original source