复制代码
代码如下:
<!DOCTY PE ht ML P ub LIC "-//W3C//DTD XHTML 1.0 Trans IT ional//EN" "http://www.w3. org /TR/xhtml1/DTD/xhtml1 -t ransitional.dtd">
<html XM lns="http://www.w3.org/1999/xhtml">
<head>
< ;m eta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>使图片相对于上层DIV始终水平、垂直都居中</title>
<style type="text/css">
.thumbBox {width:260px; h ei ght:260px; text-align: center ; vert ical -align:middle; dis play :table-cell; border:1px solid red ;}
</style>
</head>
<body>
使图片相对于上层DIV始终水平、垂直都居中
<p>示例一</p>
<div class="thumbBox">
< img src="http://www.b ai du .COM /img/bd LOG o.gif" >
</div>
<p>示例二</p>
<div class="thumbBox">
<img src="http://y2.ifengimg.com/mappa/2013/06/03/cb32ecdc7d0def4d123ae4c38c50050b. jpg " >
</div>
</body>
</html>
总结
以上是 为你收集整理的 如何让图片相对于上层DIV始终保持水平、垂直都居中 全部内容,希望文章能够帮你解决 如何让图片相对于上层DIV始终保持水平、垂直都居中 所遇到的问题。
如果觉得 网站内容还不错, 推荐好友。
查看更多关于如何让图片相对于上层DIV始终保持水平、垂直都居中的详细内容...