圣杯布局--跟着李南江学编程

2020-02-18  本文已影响0人  63537b720fdb

圣杯布局就是三栏布局,左右两栏固定,中间一栏自适应

image.png image.png
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="练习.css">
    <title>Document</title>
</head>
<body>
    <div class="box">
        <div class="center">ascsdcs.c,;cs,;s,c'asc,ascsdcs.c,;cs,;s,c'asc,
            ascsdcs.c,;cs,;s,c'asc,ascsdcs.c,;cs,;s,c'asc,ascsdcs.c,;cs,;s,c'asc,
            ascsdcs.c,;cs,;s,c'asc,ascsdcs.c,;cs,;s,c'asc,ascsdcs.c,;cs,;s,c'asc,
        </div>
        <div class="left">1</div>
        <div class="right">2</div>
    </div>
</body>
</html>
*{
    margin: 0;
    padding: 0;
    list-style: none;
    font: normal;
}
.box{
    width: 800px;
    min-width: 300px;
    background: purple;
    padding: 0 100px;
    margin: 0 auto;
    overflow: hidden;
}
.center{
    width: 100%;
    height: 100px;
    background: blue;
    float: left;
}
.left,.right{
    width: 100px;
    height: 100px;
    background: red;
    float: left;
}
.left{
    margin-left: -100%;
    position: relative;
    left: -100px;
}
.right{
    margin-left: -100px;
    position: relative;
    left: 100px;
}

我正在跟着江哥学编程,更多前端+区块链课程: www.it666.com--跟着李南江学编程

上一篇下一篇

猜你喜欢

热点阅读