第一种:
利用margin来水平居中
.bl{margin: 0 auto;background: red; 100px;height: 100px;}
第二种:利用百分比,利用50%,然后减去自己的一半.
.bl2{position: relative; left: 50%; 200px;height: 200px;background: green;margin-left: -100px;}