我想在移动设备中编辑文本的边距顶部。我已经走了这么远,但我知道代码中有一些疯狂的东西:
.Foljoss {
padding-left: 18px;
background: #fff;
}
@media screen and
(max-width: 768px; margin-top:17px)
这是我不明白的最后一部分。如何调整
<div class="Foljoss">
的上边距在手机版上?请注意 @media screen
-部分不正确。
最佳答案
您需要将 css 包装在媒体查询内的选择器中。
@media screen and (max-width: 768px) {
.Foljoss {
margin-top: 17px;
}
}
body {
background-color: lightgreen;
}
.show-on-mobile {
display: none;
}
@media screen and (max-width: 568px) {
.show-on-mobile {
display: block;
}
.hide-on-mobile {
display: none;
}
body {
background-color: lightblue;
}
}
<div class="show-on-mobile">Only visible when width is <= 568px</div>
<div class="hide-on-mobile">Disappears when screen width > 568px</div>
关于html - 如何在移动版本中编辑文本的 css margin-top,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28097196/