CSS块元素居中

来源:互联网 发布:网络信号大师 编辑:程序博客网 时间:2024/06/05 02:05

简介

在CSS中经常需要用到块元素居中,偶然遇到一种解决办法,如下,将margin的左右距离均设值为auto则元素自动居中。

{margin-left:auto;margin-right:auto;width:70%;background-color:#b0e0e6;}

原创粉丝点击