简体   繁体   English

Div以5px边距为中心 - 左,右,上和下

[英]Div centered with 5px margin-left, right, top and bottom

I want to make a div that is centered (horizontally and vertically). 我想制作一个居中(水平和垂直)的div。 It should change size with the screen, but have 5 pixel margins all around. 它应该随屏幕改变大小,但是周围有5个像素边距。

#thediv {
    position: absolute;
    top: 10px;
    right: 10px;
    bottom: 10px;
    left: 10px;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM