我想中心包含一個窗體的DIV。我已經設法使背景變灰,並希望將窗體置於窗口中央。以下是我迄今爲止所做的,但我不知道如何進一步取得我需要的結果。如何居中DIV彈出窗口?
我能夠'自動保證金'水平,但我不能夠垂直做到這一點(請參閱圖像)。如果您進一步垂直拉伸瀏覽器窗口,表單會拉伸以佔據所有的垂直空間。
#idOfForm{
margin: auto;
z-index: 10000;
position: absolute;
background-color: white;
top: 0;
bottom: 0;
left: 0;
right: 0;
padding: 10px;
width: 500px;
min-height: 250px;
border: 1px solid #ccc;
border-radius: 10px;
box-shadow: 3px 3px 3px #b8b8b8;
font-family: sans-serif;
color: #484848;
}