這段代碼為什么不能使box居中?
.back_ground{height:1000px; background-color:red; position: relative}
.loading_box{width: 500px;height: 500px;position: absolute ;margin-left: auto}
.back_ground{height:1000px; background-color:red; position: relative}
.loading_box{width: 500px;height: 500px;position: absolute ;margin-left: auto}
2016-08-17
舉報(bào)
2017-08-02
被強(qiáng)制改變的尺寸,使用margin:auto才有效
2016-10-17
box在絕對(duì)定位的情況下,需要用top:0; bottom:0; left:0; right:0 來(lái)拉伸盒子,使box在沒(méi)有設(shè)置寬高的情況下自動(dòng)填滿其父級(jí)。同時(shí)只有同時(shí)設(shè)置margin-left:auto和margin-right:auto才可以使box水平居中。
2016-08-18
因?yàn)閎ox沒(méi)有拉伸,再有居中應(yīng)該是margin:auto;