纯CSS实现图片水平垂直居中于DIV(图片未知宽高)

.demo{border:1px #ddd solid;width:267px;height:267px;overflow:hidden;text-align:center;display:table;float:left;margin:50px;position:relative;}
.demo a{display:table-cell;vertical-align:middle;width:267px;height:267px;}
.demo a img{margin:0 auto;max-width:267px;max-height:267px;}

 

 

纯CSS实现图片水平垂直居中于DIV(图片未知宽高)

posted @ 2018-01-24 09:47  对方屌丝正在输入中  阅读(139)  评论(0编辑  收藏  举报