设置DIV水平居中 Posted on 2018-10-23 Edited on 2019-10-18 In note Valine: 常见的页面居中布局 一般水平居中1234#body { position: relative; margin: auto;} 锁定sceen位置的水平居中1234567#header { position: fixed; top: 0; left: 0; right: 0; margin: auto;} 相对父级位置水平居中12345678910#footer { position: relative;}#footer > div{ position: absolute; margin: auto; right: 0; bottom: 0; left: 0;} 水平居中DEMO