css高度已知,左右定宽,中间自适应三栏布局

css高度已知,左右定宽,中间自适应三栏布局:

<!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">
    <title>Document</title>
    <style>

        *{
            margin: 0;
            padding: 0;
        }

        .box>div{
            height: 100px;
        }

        .box .left{
            background-color: red;
            width: 300px;
            float: left;
        }

        .box .right{
            background-color: blue;
            width: 300px;
            float: right;
        }

        .box .center{
            text-align: center;
            line-height: 100px;
            color: #fff;
            background-color: orange;
        }
    </style>
</head>
<body>
    
    <div class="box">
        <div class="left"></div>
        <div class="right"></div>
        <div class="center">第一种方法:浮动</div>
    </div>

</body>
</html>

  

posted @ 2017-08-19 10:03  前端站  阅读(316)  评论(0编辑  收藏  举报