浮动元素如何居中(上下)

上下居中

浮动元素左右居中:margin:0 auto;是无效的;text-align:center;也是无效的,

子相父绝;子:left:0;right:0;top:0;bottom:0;margin:auto;(顺序不可更改)

左右居中:

display:table-cell设置给子元素;

猜你喜欢

转载自blog.csdn.net/weixin_34849724/article/details/80969820
今日推荐