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?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…