[英]How can i force a margin (right and left to 50px) on the body tag of my page for screen sizes above 1280px
请我写了一些 css 来定位 body 标签,并在屏幕达到 1280px 及以上时设置它的边距(左右为 50px)。
这是我到目前为止所做的代码片段。
@media screen and (min-width: 1280px) {
body{
margin-left: 50px !important;
background-color: #F0F0F0 !important;
margin-right: 50px !important;
}
}
如果您只需要左右各 50px 的边距,下面的代码可以帮助您:
@media (min-width: 1280px)
{
body
{
margin-right: 50px;
margin-left: 50px;
}
}
但是我建议你使用像宽度这样的百分比:95% 更好
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.