/CSS 图片在DIV中垂直居中的显示方法

来源:互联网 发布:蒲公英ios软件 编辑:程序博客网 时间:2024/04/20 00:05
<style type="text/css">.thumb{ width:120px; height:120px; border:1px solid red; display:table-cell;/*最重要*/ vertical-align:middle;/*设置水平居中*/ }.thumb img{ border:none; max-width:100%; max-height:100%; display:block; margin:auto;/*设置垂直居中*/ }</style><div class="thumb" ><A><img src="1.jpg" /></A></div><div class="thumb" style="margin-left:50px;"><A><img src="2.jpg" /></A></div>

0 0
原创粉丝点击