码迷,mamicode.com
首页 > 其他好文 > 详细

网易笔试题目:三列布局,中间自适应宽度,双飞翼布局

时间:2016-03-23 18:26:38      阅读:132      评论:0      收藏:0      [点我收藏+]

标签:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <style type="text/css">
        .wrap{
            width: 100%;
        }
        .one{
            float: left;
            width: 100px;
            margin-right: -100px;
            background: yellow;
            min-height: 100px;
        }
        .three{
            float: right;
            width: 100px;
            margin-left: -100px;
            min-height: 100px;
            background: green;
        }
        .wrap_two{
            width: 100%;
            float: left;
        }
        .two{
            margin: 0 110px 0 110px;
            min-height: 100px;
            background: purple;
        }
    </style>
</head>
<body>
<div class="wrap">
    <div class="one">第一个</div>
    <div class="wrap_two">
        <div class="two">第二个</div>
    </div>
    <div class="three">第三个</div>

</div>
</body>
</html>

思考,首先水平,水平的办法有那么几种,display:inline-block;float,但是这种方法width不生效,所以float方法,双飞翼就是中间宽度为100%,两边六点空,挂上翅膀,两边的翅膀宽度和对中间身体的拉进来的值相等,他们margin的是中间列的父级div也就是wrap_two,中间列在wrap_two内部两边留白之后就是中间的实际宽度。

效果图如下:技术分享

网易笔试题目:三列布局,中间自适应宽度,双飞翼布局

标签:

原文地址:http://www.cnblogs.com/siwy/p/5312253.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!