📜  如何根据屏幕大小更改样式 - CSS 代码示例

📅  最后修改于: 2022-03-11 14:47:51.957000             🧑  作者: Mango

代码示例1
.adjust-me-based-on-size{
  margin-left: 15%;
  margin-right: 15%;
}
@media only screen and (min-width: 800) and (max-width: 1200) {
  .adjust-me-based-on-size {

    margin-left: 10%;
    margin-right: 10%;
  }
}
@media only screen and (max-width: 800px) {
  .adjust-me-based-on-size {
    margin-left: 5%;
    margin-right: 0%;
  }
}
 Run code snippet