使图片相对于上层DIV始终水平、垂直都居中
2013-08-11 18:38
465 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>使图片相对于上层DIV始终水平、垂直都居中</title> <style type="text/css"> .thumbBox {width:260px; height:260px; text-align:center; vertical-align:middle; display:table-cell; border:1px solid red;} </style> </head> <body> 使图片相对于上层DIV始终水平、垂直都居中 <p>示例一</p> <div class="thumbBox"> <img src="http://www.baidu.com/img/bdlogo.gif" > </div> <p>示例二</p> <div class="thumbBox"> <img src="http://y2.ifengimg.com/mappa/2013/06/03/cb32ecdc7d0def4d123ae4c38c50050b.jpg" > </div> <p>查找更多代码,请访问:<a href="http://www.lanrentuku.com" target="_blank">懒人图库</a></p> </body> </html>
相关文章推荐
- 如何让图片相对于上层DIV始终保持水平、垂直都居中
- 如何让图片相对于上层DIV始终保持水平、垂直都居中
- 使当前对象相对于上层DIV 水平、垂直居中定位
- div中图片水平垂直居中
- 【DIV+CSS】DIV背景图片水平垂直居中
- 未知宽高图片水平垂直居中在div
- div图片水平垂直居中不随滚动条滚动的CSS代码(兼容IE8+)
- css实现图片在div中水平和垂直居中(但图片宽高要小于div宽高)
- DIV里面的图片水平与垂直居中的方法
- 图片在DIV中水平与垂直居中<转>
- 在DIV中图片垂直、水平居中(最简单方法)
- DIV里面的图片水平与垂直居中的方法
- div中图片水平垂直居中
- 纯CSS实现图片水平垂直居中于DIV(图片未知宽高)
- 如何让DIV相对于body水平和垂直居中
- CSS布局:图片在DIV中上下左右居中(水平和垂直都居中)
- 网页常见布局,让图片在div中,垂直居中,水平居中
- DIV内部图片垂直水平居中例子
- 让图片在DIV容器里面水平垂直居中的方法
- 实现div里的img图片水平垂直居中