给一个div绝对定位后,如何让它水平居中

<style>

.footer{position:absolute;left:0;right:0}

</style>

<div classs="footer">

<button>结束</button>

</div>

也就是说只要给你所定位的div的类加上left:0;right:0;(margin:auto;这个好像不加也管用)就可以了!

原文地址:https://www.cnblogs.com/fkcqwq/p/5464531.html