zoukankan      html  css  js  c++  java
  • 关于图片在div中居中问题

        ①作为背景图片
           
     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>
        ②作为普通图片
     
     
  • 相关阅读:
    vue 中使用阿里iconfont彩色图标
    团队作业九
    团队作业八
    团队作业七
    第二篇
    第三篇
    第一篇
    beta冲刺计划安排
    团队作业六
    团队作业五
  • 原文地址:https://www.cnblogs.com/zlj1027/p/5971639.html
Copyright © 2011-2022 走看看