首页 > 其他 > 详细

关于图片在div中居中问题

时间:2016-10-18 02:01:08      阅读:146      评论:0      收藏:0      [点我收藏+]

 

    ①作为背景图片
       
 1  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 2             <html xmlns="http://www.w3.org/1999/xhtml">
 3             <head>
 4             <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
 5             <title>无标题文档</title>
 6             <style>
 7             .img{
 8               overflow: auto;
 9               text-align: center;
10               height: 200px;width: 90%;
11               margin:0 auto 20px;
12               border-radius: 0px; 
13               background-repeat: no-repeat;
14               background-position: center top;
15               -webkit-background-size: 100% 150px;
16               background-size:  100% 200px;
17               border:1px solid red;
18             }
19             </style>
20             </head>
21  
22             <body>
23             <div class="img" style="background-image:url(../image/5.png)">
24  
25             </div>
26             <script>
27  
28             </script>
29             </body>
30             </html>
    ②作为普通图片
 
 

关于图片在div中居中问题

原文:http://www.cnblogs.com/zlj1027/p/5971639.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!