zoukankan      html  css  js  c++  java
  • 纯CSS写九宫格样式,高宽自适应正方形

     

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8">
            <title>九宫格</title>
            <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,initial-scale=1.0,width=device-width" />
            <style type="text/css">
                a, body, center, cite, code, dd, del, div, dl, dt, em, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hr, html, img, input, label, legend, li, mark, ol, p, section, span, strong, textarea, time, ul, var input{
                    margin: 0;
                    border: 0;
                    padding: 0;
                    font-style: normal;
                    color: #323232;
                    box-sizing: border-box;
                    -moz-box-sizing:border-box; /* Firefox */
                    -webkit-box-sizing:border-box; /* Safari */
                }
                html,body{
                    background: #fff;
                }
                ul{
                    text-decoration: none;
                    list-style-type: none;
                }
                .video_list>li{
                    float: left;
                     32%;
                    text-align: center;
                    border: 1px solid #ccc;
                    padding-top: 31%;
                    margin-left: 1%;
                    margin-top: 1%;
                    position: relative;
                }
                .video_list>li>div{
                    position: absolute;
                    left: 0;
                    top: 0;
                     100%;
                    height: 100%;
                    background-color: #09BE07;
                }
                .video_list>li>div>span{
                    display: inline-block;
                    margin-top: 50%;
                    -webkit-transform: translateY(-50%);
                    transform: translateY(-50%);
                }
            </style>
        </head>
        <body>
            <ul class="video_list">
                <li><div><span>1</span></div></li>                    
                <li><div><span>2</span></div></li>                    
                <li><div><span>3</span></div></li>                    
                <li><div><span>4</span></div></li>                    
                <li><div><span>5</span></div></li>                    
                <li><div><span>6</span></div></li>                    
                <li><div><span>7</span></div></li>                    
                <li><div><span>8</span></div></li>                    
                <li><div><span>9</span></div></li>                    
            </ul>    
        </body>
    </html>

  • 相关阅读:
    AVLTree的实现以及左右旋转维持自平衡
    哈希函数之布隆过滤器
    LeetCode——线段树解决区间总和问题
    第23章 Windows身份验证
    第22章 使用外部身份提供商登录
    第21章 登录
    第20章 定义客户端
    第19章 定义资源
    第18章 启动
    第17章 社区快速入门和模板
  • 原文地址:https://www.cnblogs.com/gdcgy/p/5284188.html
Copyright © 2011-2022 走看看