zoukankan      html  css  js  c++  java
  • div+css垂直居中

    一、显示的图片分别为小图,宽度大的图片,高度大的图片分别显示以下效果。

    <style type="text/css">   

    .example{  

    100%;    

    text-align:center;    

    margin-bottom: 30px;    

    margin-top: 20px;

    }

    .example  div{  

    500px;  

    height:400px;    

    text-align: center;    

    display: table-cell;    

    vertical-align: middle;    

    border: 1px solid rgba(0, 0, 0, 0.43); }

    .example  img{    

    max-height:400px;  

    max-500px;    

    vertical-align: middle; }

    </style>  

    <div class="example fn-clear" >

                        <center>                               

                                     <div>                                    

                                       <img style="border: 1px solid grey" src="C:UsersPublicPicturesSample Picturesw.jpg"/>                               

                                     </div>                    

                       </center>  

                    </div>

    </body>

    </html>

    二、显示一排图片的处理效果

    <style type="text/css">

    .list_con li{  float:left;  padding:25px 18px 0 0;  146px; }

    .list_con li div {  border: 1px solid  #000;     border-image: none;     146px;     height: 146px;     text-align: center;     vertical-align: middle;     display: table-cell;     line-height:143px; }

    .list_con .ph_pic img{  max-146px;  max-height:146px;     vertical-align: middle; }

    .list_con p{  padding:8px 0 5px;  text-align:center; }

    .list_con p img{  padding:0 16px;  16px;  height:16px; }

    .fn-clear:after {  visibility:hidden;  display:block;  font-size:0;  content:" ";  clear:both;  height:0; }

    .fn-clear {  zoom:1; /* for IE6 IE7 */ }

    </style>

    <div class="list_con fn-clear">
             <ul style="list-style:none">
                 <li>
                    <div>
                     <a  target="_blank" class="ph_pic"   href="#"> <img style="border: 1px solid grey" src="../../UploadFiles/123.gif"/><a>
                    </div>                 
                    </li>
                    /* 复制7个li*/
                </ul>
     </div>

    效果如下:

  • 相关阅读:
    git在iOS开发中的使用
    搜索联系人是去掉拼音中的空格
    xmPP(即时通讯)向远程服务器请求数据
    使用CFStringTransform进行汉字转拼音(可去掉声调)
    node的模块系统和commonJS规范的关系
    在centos7中通过使用yum安装mongoDB
    vue跨组件通信,简易状态管理的使用
    Linux(centos7) 常用命令
    前端打包后, 路由模式为history时,用express测试服务端能否正常解析路由路径
    几个文件目录树生成工具tree,treer,tree-cli,tree-node-cli的使用配置和对比
  • 原文地址:https://www.cnblogs.com/angelfeeling/p/3628376.html
Copyright © 2011-2022 走看看