Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
143
rated 0 times [  145] [ 2]  / answers: 1 / hits: 20732  / 10 Years ago, thu, may 29, 2014, 12:00:00

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?


More From » html

 Answers
11

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!


[#70809] Tuesday, May 27, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
andreguym

Total Points: 125
Total Questions: 112
Total Answers: 103

Location: Wallis and Futuna
Member since Tue, Mar 30, 2021
3 Years ago
;