I have two div elements on a page.
How can I make one div float over another just like a popup? In other words, div2 (the popup) would cover some part of the area of div1 (the parent).
I have two div elements on a page. How can I make one div
Share
Use
position:absolute;and set the “popup” one to be positioned within the boundaries of the other. The “popup” div should likely also be smaller.Use
z-indexto stack the “popup” one above the other one (give it a higher value forz-index).If you want to make it look like the inner div is really floating above the other one, create a shadow with something like
border-right:2px solid blackandborder-bottom:2px solid black.If you want to make it actually pop up/appear/disappear, you will need to use some script.