即使在移动设备和Windows大小调整上,我也会遇到一些麻烦,即制作2个100%宽度的div。目前它只是切断,看起来不太好。
Click here用于网站的实时预览。
CSS:
#wrap {
margin: auto;
width: 1170px;
}
#helper {
width: 100%;
max-width: 100%;
min-width: 1024px;
height: 250px;
}
#header {
background-image: url("space.png");
background-size: cover;
background-position: center center;
height: inherit;
width: 100%;
min-width: 1024px;
animation: animatedBackground 35s linear infinite;
animation-fill-mode: forwards;
}
#menu {
background: #FFF;
border-bottom: 1px solid #c9cccd;
height: 70px;
width: 100%;
min-width: 1024px;
-webkit-box-shadow: 0 -20px 20px -20px rgba(0,0,0,0.8);
-moz-box-shadow: 0 -20px 20px -20px rgba(0,0,0,0.8);
box-shadow: 0 -20px 20px -20px rgba(0,0,0,0.8);
transition: 0.3s all ease-in;
}
HTML:
<div id="helper">
<div id="header">
<div id="wrap">
<a href=""><img src="neclogo.png" alt="" style="margin-top: 80px;" /></a>
</div>
</div>
<div id="menu">
<div id="wrap">
<div id="logotype" class="steam" data-tip="NecGaming on Steam"><a href="#" class="steam-popup"><i class="fa fa-steam" style="padding:0"></i></a></div>
<ul>
<li><i class="fa fa-comments"></i><a href="#">Forum</a></li>
<li><i class="fa fa-users"></i><a href="#">Members</a></li>
<li><i class="fa fa-server"></i><a href="#">Servers</a></li>
<li><i class="fa fa-list"></i><a href="#">Ranking</a></li>
<li><i class="fa fa-money"></i><a href="#">Donate</a></li>
<li><i class="fa fa-question"></i><a href="#">FAQ</a></li>
</ul>
<a href="#signup" rel="signup"><div id="register">Register</div></a>
<a href="#signin" rel="signin"><div id="login">Sign In</div></a>
</div>
</div>
</div>
我只是想知道如何让背景“重复”/无论如何都是100%宽度,即使在Windows调整大小和移动设备(手机/平板电脑)上也是如此。
答案 0 :(得分:2)
删除min-width,应该这样做。