Blogger Information
Blog 35
fans 0
comment 0
visits 22333
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
html和css基础知识(双飞翼布局)—2018年8月20日 12:48:28
Hi的博客
Original
787 people have browsed it

布局在html中是不不可少的,双飞翼是经典的布局。

作用在于主体优先渲染,他和圣杯布局最大的区别在于。他在主体内容的上一级在嵌套一个盒子,指定盒子宽度继承父级。

左和右用margin指定位置。主体内容使用margin来挤压得到

以下是我的手写关于双飞翼和圣杯的区别

2018-8-17手抄代码.jpg

以下是我的代码。

实例

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>双飞翼布局</title>
    <style>
        body{
            margin: 0;
            padding: 0;
        }
        .header{
            width: 100%;
            height: 100px;
            background: powderblue;

        }
        .footer{
            width: 100%;
            height: 100px;
            background: powderblue;

        }
        .content{
            width: 1000px;
            min-height: 100%;
            margin: 0 auto;
            background: #0388f1;
            text-align: center;
            line-height: 100px;
        }
        .container{
            width: 1000px;
            margin: auto;
            overflow: hidden;
            text-align: center;
            background: powderblue;
        }
        .wrap{
            width: 100%;
            float: left;
            background: #ffe80e;
        }
        .main{
            min-height: 800px;
            background: hotpink;
            margin:0 150px;
        }
        .left{
            width: 150px;
            min-height: 800px;
            float: left;
            background: indianred;
            margin-left: -100%;
        }
        .right{
            width: 150px;
            min-height: 800px;
            float: left;
            background: limegreen;
            margin-left: -150px;
        }
        ul{
            margin: 0;
            padding: 0;
        }
        ul li{
            list-style: none;
            display: block;
            float: left;
            margin-left: 100px;

        }
        a{
            text-decoration: none;
            color: white;
        }
        a:llink{
            color: white;
        }
        a:visited{
            color: white;
        }
        .maid1{
            width: 100%;
            min-height: 400px;
        }
        .maid2{
            width: 100%;
            min-height: 400px;
        }
        .zuo {
            width: 200px;
            height: 300px;
            background: white;
            float: left;
            margin-top: 50px;
            margin-left: 25px;
        }
        .zhong {
            width: 200px;
            height: 300px;
            background: white;
            float: left;
            margin-top: 50px;
            margin-left: 25px;
        }
        .you {
            width: 200px;
            height: 300px;
            background: white;
            float: left;
            margin-top: 50px;
            margin-left: 25px;
        }
        .left1 {
            width: 100%;
            height: 395px;
            background: #ffe80e;
            margin-bottom: 10px;
        }
        .left2{
            width: 100%;
            height: 395px;
            background: beige;
        }
        .right1 {
            width: 100%;
            height: 395px;
            background: #ffe80e;
            margin-bottom: 10px;
        }
        .right2{
            width: 100%;
            height: 395px;
            background: beige;
        }
    </style>
</head>
<body>
<div class="header">
    <div class="content">
        <ul>
            <li><a href="test">首页</a></li>
            <li><a href="test">新闻</a></li>
            <li><a href="test">娱乐</a></li>
            <li><a href="test">音乐</a></li>
            <li><a href="test">关于我们</a></li>
            <li><a href="test">联系我们</a></li>
        </ul>
    </div>
</div>
<div class="container">
    <div class="wrap">
        <div class="main">
            <div class="maid1">
                <div class="zuo"></div>
                <div class="zhong"></div>
                <div class="you"></div>
            </div>
            <div class="maid2">
                <div class="zuo"></div>
                <div class="zhong"></div>
                <div class="you"></div>
            </div>
        </div>
    </div>
    <div class="left">
        <div class="left1"></div>
        <div class="left2"></div>
    </div>
    <div class="right">
        <div class="right1"></div>
        <div class="right2"></div>
    </div>
</div>
<div class="footer">
    <div class="content">
        <ul>
            <li><a href="test">首页</a></li>
            <li><a href="test">新闻</a></li>
            <li><a href="test">娱乐</a></li>
            <li><a href="test">音乐</a></li>
            <li><a href="test">关于我们</a></li>
            <li><a href="test">联系我们</a></li>
        </ul>
    </div>
</div>
</body>
</html>

运行实例 »

点击 "运行实例" 按钮查看在线实例


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments