I've implemented a popup box that dynamically displays search options. I want the box to "float" above all of the site content. Currently, when the box is displayed it displaces all of the content below it and looks bad.
I believe I've already tried setting the z-index of the box's div to above that of the remaining page content, but still no luck.
Answer: Use the CSS z-index Property You can use the CSS position property in combination with the z-index property to overlay an individual div over another div element.
The vertical position of the element to be stuck can also be modified with the help of the 'top' property. It can be given a value of '0px' to make the element leave no space from the top of the viewport, or increased further to leave space from the top of the viewport.
Use CSS property to set the height and width of div and use display property to place div in side-by-side format. float:left; This property is used for those elements(div) that will float on left side. float:right; This property is used for those elements(div) that will float on right side.
You want to use absolute positioning.
An absolute position element is positioned relative to the first parent element that has a position other than static. If no such element is found, the containing block is html
For instance :
.yourDiv{ position:absolute; top: 123px; }
To get it to work, the parent needs to be relative (position:relative
)
In your case this should do the trick:
.suggestionsBox{position:absolute; top:40px;} #specific_locations_add{position:relative;}
Use
position: absolute; top: ...px; left: ...px;
To position the div. Make sure it doesn't have a parent tag with position: relative;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With