码迷,mamicode.com
首页 > Web开发 > 详细

CSS3简单的栅格系统

时间:2016-11-23 20:13:09      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:splay   pad   meta   isp   list   html   oat   title   style   

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>高仿栅格系统</title>
    <!--栅格系统-->
    <link rel="stylesheet" href="css/small-grid.css">
    <!---->
    <link rel="stylesheet" href="css/index.css">
</head>
<body>
    <div class="main small-container">
        <!--一列12个-->
        <div class="small-row">
            <div class="col-1 have-border">A</div>                     
            <div class="col-1 have-border">A</div>                     
            <div class="col-1 have-border">A</div>                     
            <div class="col-1 have-border">A</div>                     
            <div class="col-1 have-border">A</div>                     
            <div class="col-1 have-border">A</div>                     
            <div class="col-1 have-border">A</div>                     
            <div class="col-1 have-border">A</div>                     
            <div class="col-1 have-border">A</div>                     
            <div class="col-1 have-border">A</div>                     
            <div class="col-1 have-border">A</div>                     
            <div class="col-1 have-border">A</div>                     
        </div>
        <div class="small-row">
            <div class="col-1 have-border">A</div>
            <div class="col-11 have-border">B</div>                       
        </div>
        <!--一列6个-->
        <div class="small-row">
            <div class="col-2 have-border">A</div>
            <div class="col-2 have-border">A</div>
            <div class="col-2 have-border">A</div>
            <div class="col-2 have-border">A</div>
            <div class="col-2 have-border">A</div>
            <div class="col-2 have-border">A</div>
        </div>
        <div class="small-row">
            <div class="col-2 have-border">A</div>
            <div class="col-10 have-border">B</div>
        </div>
        <!--4个-->
        <div class="small-row">
            <div class="col-3 have-border">A</div>
            <div class="col-3 have-border">A</div>
            <div class="col-3 have-border">A</div>
            <div class="col-3 have-border">A</div>
        </div>
        <div class="small-row">
            <div class="col-3 have-border">A</div>
            <div class="col-9 have-border">B</div>
        </div>
        <!--3个-->
         <div class="small-row">
            <div class="col-4 have-border">A</div>
            <div class="col-4 have-border">A</div>
            <div class="col-4 have-border">A</div>
        </div>
        <div class="small-row">
            <div class="col-4 have-border">A</div>
            <div class="col-8 have-border">B</div>
        </div>
        <div class="small-row">
            <div class="col-5 have-border">A</div>
            <div class="col-7 have-border">B</div>
        </div>
        <div class="small-row">
            <div class="col-6 have-border">A</div>
            <div class="col-6 have-border">B</div>
        </div>
    </div>
</body>
</html>
*{
    margin: 0;
    padding: 0;
    border: 0;
    list-style: none;
    box-sizing: border-box;
}

.small-container{
    width: 100%;
}
.small-container,.small-row{
    box-sizing: border-box;
}
.small-row::before,
.small-row::after{
    content: ‘‘;
    display: block;
    visibility: hidden;
    clear: both;
    zoom: 1;
}
[class*=‘col-‘]{
    float: left;
    padding: 1%;
}
.col-1{
    width: 8.33%;
}
.col-2{
    width: 16.66%;
}
.col-3{
    width: 25%;
}
.col-4{
    width: 33.33%;
}
.col-5{
    width: 41.66%;
}
.col-6{
    width: 50%;
}
.col-7{
    width: 58.33%;
}
.col-8{
    width: 66.66%;
}
.col-9{
    width: 75%;
}
.col-10{
    width: 83.33%;
}
.col-11{
    width: 91.66%;
}
.col-12{
    width: 100%;
}

  

  

CSS3简单的栅格系统

标签:splay   pad   meta   isp   list   html   oat   title   style   

原文地址:http://www.cnblogs.com/binmengxue/p/6094752.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!