在CSS布局中经常会使用margin:auto来时实现水平居中,究其真正的原因问了一些专门开发web前端的人员,也不知道具体的愿意,所以专门用这篇博客记录下来,以备不时之需,
.el{
position: absolute;
left: 0; top: 0; right: 0; bottom: 0;
margin: auto; /* 有了这个就可以实现自动居中了 */
}
在CSS布局中经常会使用margin:auto来时实现水平居中,究其真正的原因问了一些专门开发web前端的人员,也不知道具体的愿意,所以专门用这篇博客记录下来,以备不时之需,
.el{
position: absolute;
left: 0; top: 0; right: 0; bottom: 0;
margin: auto; /* 有了这个就可以实现自动居中了 */
}