I have a div that will have this CSS:
#some_kind_of_popup
{
position: fixed;
top: 100px;
min-height: 300px;
width: 90%;
max-width: 900px;
}
Now, how can i make this div centered? I can use margin-left: -450px; left: 50%;
but this will only work when the screen is > 900 pixels. After that (when the window is < 900 pixels), it will no longer be centered.
I can of course do this with some kind of js, but is there a "more correct" of doing this with CSS?
margin: 0 auto
on aposition: fixed
div. Did you even read the question? – Belomancyfixed
positioned element. – Alkanet