【发布时间】:2019-06-01 05:10:35
【问题描述】:
我在此网站上提供 2 张图片,一张用于大屏幕,另一张用于移动设备:
stickersgallito.pe(如果你需要另一个 css 类)
移动设备的图像远低于预期。我可以使图像上升:top: -40px;,但这会在绿色横幅和图像之间产生间隙。
CSS 类:
.my_home_banner_image {
bottom: 0;
top: 0;
position: relative;
z-index: 0;
width: 100%;
display: block;
margin-right: auto;
margin-left: 0px;
}
差距:
我想:
1) 让图像离橙色按钮更近 40 像素。
2) 在蓝色和橙色按钮之间留出更多空间(奖励)。
完成媒体查询:
@media (max-width: 480px) {
/* smartphones, iPhone, portrait 480x320 phones */
.my_home_banner {
bottom: 0;
margin-right: 8%;
z-index: -600;
}
.productos_finales_home img {
padding-bottom: 15px;
}
.my_home_banner_image {
bottom: 0;
top: 0;
position: relative;
z-index: 0;
width: 100%;
display: block;
margin-right: auto;
margin-left: 0px;
}
.my_home_banner_title {
color: white;
font-size: 36px;
font-weight: bold;
}
.my_home_banner_subtitle {
margin-top: 0%;
padding-top: 0%;
}
.btn, h2, p {
margin-bottom: 10px;
}
.btn-comentario {
text-decoration: none;
background-color: #969696;
display: inline-block;
text-align: center;
vertical-align: middle;
cursor: pointer;
color: #fff;
font-weight: 700;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
text-shadow: 0 -1px 0 rgba(0, 0, 0, .25);
letter-spacing: 0;
line-height: 1.2;
-webkit-font-smoothing: antialiased;
-webkit-box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15);
-ms-box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15);
-moz-box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15);
-o-box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15);
box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15);
background-image: linear-gradient(to bottom, rgba(255, 255, 255, .09) 0%, rgba(0, 0, 0, .09) 100%);
font-size: 1.4rem;
padding: 22px 30px;
border-radius: 6px;
border: none;
}
.my_home_banner_left {
margin-left: 10px;
z-index: 100;
}
.stickers_referenciales {
margin-bottom: 5px;
}
}
Codepen
【问题讨论】:
标签: css