美文网首页1024Web前端之路让前端飞
CSS Grid 布局之左中右三栏布局案例

CSS Grid 布局之左中右三栏布局案例

作者: 圆梦人生 | 来源:发表于2017-05-24 16:02 被阅读151次

来源:http://itssh.cn/post/942.html

关于grid介绍参考:http://sm0210.cn/post/940.html

使用CSS Grid 实现左中右三栏布局案例:

<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="apple-mobile-web-app-capable" content="yes" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
        <title>CSS Grid 布局之左中右三栏布局案例</title>
        <!--
            @author:SM
            @email:sm0210@qq.com
            @desc:CSS Grid 布局之左中右三栏布局案例
         -->
        <!-- 自定义css -->
        <style type="text/css">
            * {
                margin: 0;
                padding: 0;
            }
            /*
                
            */
            .box,
            .content {
                display: grid;
            }
            /*
                
            */
            .box {
                grid-template-rows: 1fr;
                grid-row-gap: 10px;
                color: #fff;
            }
            
            .header {
                height: 100px;
            }
            /*
                
            */
            .content {
                height: 400px;
                grid-template-columns: 120px 1fr 120px;
                grid-column-gap: 10px;
            }
            .footer {
                height: 80px;
            }
            /*
                
            */
            .header,
            .content *,
            .footer {
                background-color: #7AB8ED;
            }
        </style>
    </head>
    <body>
    
        <!-- css grid布局 -->
        <div class="box">
            
            <div class="header">header</div>
            <div class="content">
                <div>nav</div>
                <div>article</div>
                <div>aside</div>
            </div>
            <div class="footer">footer</div>
            
        </div>
        
    </body>
</html>

效果:

image.png

来源:来源:http://itssh.cn/post/942.html

相关文章

  • CSS Grid 布局之左中右三栏布局案例

    来源:http://itssh.cn/post/942.html 关于grid介绍参考:http://sm0210...

  • CSS Grid 布局之左右两栏布局案例

    来源:http://itssh.cn/post/941.html 关于grid介绍参考:http://itssh....

  • CSS Grid 布局

    参考资料 CSS Grid 布局完全指南(图解 Grid 详细教程) CSS Grid 系列(上)-Grid布局完...

  • CSS Grid 布局完全指南1-grid基础知识

    CSS Grid 布局是 CSS 中最强大的布局系统。与 flexbox 的一维布局系统不同,CSS Grid 布...

  • Grid布局参考资料

    张鑫旭-写给自己看的display: grid布局教程阮一峰-CSS Grid 网格布局教程 在Grid布局中,f...

  • 2020-02-03

    六、栅格布局方式Grid 众人云,Grid布局是CSS中最强的布局方式。Grid 布局与 Flex 布局有一定的相...

  • css Grid布局

    Grid布局 css的布局方式主要有三种:float&position布局、flex布局、grid布局。 floa...

  • 快速开始grid布局

    Grid布局概念 CSS Gird已经被W3C纳入到css3的一个布局模块中,被称为CSS Grid Layout...

  • Grid布局

    Grid 布局是 CSS 中最强大的布局系统。与 flex 的一维布局系统不同,CSS Grid 布局是一个二维布...

  • CSS Grid网格布局

    参考资料 CSS Grid 网格布局教程 - 阮一峰 概述 网格布局(Grid)是最强大的 CSS 布局方案。 它...

网友评论

    本文标题:CSS Grid 布局之左中右三栏布局案例

    本文链接:https://www.haomeiwen.com/subject/dsroxxtx.html