我正在嘗試製作一個靜態頁面,您將無法在全屏時滾動。我只想讓我的表單居中,背景圖像隨窗口大小而改變。如果這真的很明顯,我是一個初學者很抱歉。沒有滾動條的可調整大小的背景圖片
.container {
display: flex;
justify-content: center;
/* center horizontally */
align-items: center;
/* center vertically */
}
.trans {
background: rgba(1, 1, 1, 0.6);
}
body {
height: 100%;
}
.height {
height: 100%
}
html {
height: 100%;
background: url(wallpaper.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
<div class="container height">
<form id="form">
<input class="trans text" type="password" name="Password">
<button type="submit">Submit</button>
</form>
</div>
不要忘了復位機構的預設保證金http://stackoverflow.com/questions/13127887/html-default-body-margin – DaniP