圣杯布局-完整代码

理解圣杯和双飞翼链接参考

padding margin 实现圣杯布局


<html>
    <head>
        <meta charset="UTF-8">
        <title>title>
        

        

        

        <style type="text/css">
            *{
                margin: 0;
                padding: 0;
            }
            body{
                min-width: 600px;
            }
            #content{
                padding: 0 200px;
                overflow: hidden;
            }
            #header,#footer{
                height: 20px;
                text-align: center;
                border: 1px solid  deeppink;
                background: gray;
            }
            #content .middl,#content .left,#content .right{
                padding-bottom: 10000px;
                margin-bottom: -10000px;
            }
            #content .middle{
                float: left;
                width: 100%;
                background: pink;
                /*padding: 0 200px;*/
            }
            #content .left{
                position: relative;
                left: -200px;
                margin-left: -100%;
                float: left;
                width: 200px;
                background: yellow;
            }
            #content .right{
                position: relative;
                right: -200px;
                margin-left: -200px;
                float: left;
                width: 200px;
                background: yellow;
            }



            .clearfix{
                *zoom: 1;
            }
            .clearfix:after{
                content: "";
                display: block;
                clear: both;
            }
        style>
    head>
    <body>
        <div id="header">headerdiv>
        <div id="content" class="clearfix">
            <div class="middle">
                <h4>middleh4>
                <h4>middleh4>
                <h4>middleh4>
                <h4>middleh4>
                <h4>middleh4>
            div>
            <div class="left">leftdiv>
            <div class="right">rightdiv>
        div>
        <div id="footer">footerdiv>
    body>
html>

特效
圣杯布局-完整代码_第1张图片

你可能感兴趣的:(前端初识)