html - 如何在移动版本中编辑文本的 css margin-top

标签 html css

我想在移动设备中编辑文本的边距顶部。我已经走了这么远,但我知道代码中有一些疯狂的东西:

.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/

相关文章:

css - 等高div

html - 如何在图像上放置文本 block ?

html - 为什么各大网站都没有通过 W3C 验证?

javascript - CSS Sprites - 如何让悬停按钮处于按下状态

java - 使用 Spring 将数据从 Thymeleaf 传递到 Controller

javascript - 切换可见性不起作用 (HTML/CSS/Javascript)

CSS/DIV 问题

javascript - 如何使整个网页变暗并显示 float 交互式框?

JavaScript : "event is sent to an element" -

Jquery - 文件输入上的光标指针,可能吗?