【发布时间】:2017-10-09 13:27:07
【问题描述】:
这是我的桌面代码
英雄是一类旗帜,所有的东西都写在其中。
.hero {
position: relative;
background: url('../img/banner.png') no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
text-align: center;
color: #fff;
padding-top: 110px;
min-height: 500px;
letter-spacing: 2px;
font-family: "Montserrat", sans-serif;
}
.hero h1 {
font-size: 50px;
line-height: 1.3;
}
.hero h1 span {
font-size: 25px;
color: #e8f380;
border-bottom: 2px solid #e8f380;
padding-bottom: 12px;
line-height: 3;
}
.mouse {
display: block;
margin: 0 auto;
width: 26px;
height: 46px;
border-radius: 13px;
border: 2px solid #e8f380;
position: absolute;
bottom: 40px;
position: absolute;
left: 50%;
margin-left: -26px;
}
.mouse span {
display: block;
margin: 6px auto;
width: 2px;
height: 2px;
border-radius: 4px;
background: #e8f380;
border: 1px solid transparent;
-webkit-animation-duration: 1s;
animation-duration: 1s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-animation-name: scroll;
animation-name: scroll;
}
@-webkit-keyframes scroll {
0% {
opacity: 1;
-webkit-transform: translateY(0);
transform: translateY(0);
}
100% {
opacity: 0;
-webkit-transform: translateY(20px);
transform: translateY(20px);
}
}
@keyframes scroll {
0% {
opacity: 1;
-webkit-transform: translateY(0);
-ms-transform: translateY(0);
transform: translateY(0);
}
100% {
opacity: 0;
-webkit-transform: translateY(20px);
-ms-transform: translateY(20px);
transform: translateY(20px);
}
}
<div class="hero">
<h1><span>Welcome to</span><br>Navigation</h1>
<div class="mouse">
<span></span>
</div>
</div>
添加一些媒体查询后
@media only screen and (max-width: 412px){
.hero{
background: url('../img/smallbanner.png') no-repeat center center fixed;
}
}
这是我的全部代码 使用媒体查询后,我仍然无法在移动视图中获得合适的图像。移动视图中的图像仍在下降。
我已经尝试了所有媒体查询和小横幅图片,但仍然无法正常工作。
【问题讨论】:
标签: html twitter-bootstrap css