I'm looking for a way to display a confirm dialog that's always centered on the page, and floating over the page.
Tried that, but it's not 'always centered' at all, since the position is fixed:
.Popup
{
text-align:center;
position: absolute;
bottom: 10%;
left: 27%;
z-index:50;
width: 400px;
background-color: #FFF6BD;
border:2px solid black;
}
Any idea? Thanks
Try using this CSS
#centerpoint should be the container div of the dialog
Note that the #centerpoint DIV should be inside the body element or inside elements that don't have a position: relative; property
CSS3 transform can be used to avoid hardcoded width and margins:
Example usage: http://tympanus.net/codrops/2013/06/25/nifty-modal-window-effects/
That's horizontal alignment; vertical alignment is a little trickier. Just Google around for "css vertical center" or something.
Compared to @Toma's answer, you can do it on one element
This allows you to place it anywhere on the page regardless of parent containers and their
position
properties.