目標是讓包含兩個圖像的div始終處於浮動視口的中間位置。有沒有辦法做到這一點,而不必做媒體查詢調整每種類型的屏幕的邊緣和底部?感謝您提前幫助。如何使div始終使用CSS浮動視口中心
body {
background: url(../images/willscape-bg.png);
background-repeat: no-repeat;
background-size: 100% 100%;
/* background-position: center top; */
background-attachment: fixed;
}
.container {
height: 100vh;
}
.willscape-holder {
width: 100%;
max-width: 350px;
margin: 0 auto;
padding: 0 20px;
}
#willscape-logo {
padding: 0 60px;
width: 100%;
}
#willscape-title {
width: 100%;
max-width: 500px;
}
<body>
<div class="container">
<div class="willscape-holder">
<a href="" target="_blank"><img class="img-responsive" id="willscape-logo" src="assets/images/willscape-logo.png" /></a>
<a href="" target="_blank"><img class="img-responsive" id="willscape-title" src="assets/images/willscape.png" /></a>
</div>
</div>
</body>