A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 不二晨 金牌黑马   /  2019-3-22 09:40  /  716 人查看  /  1 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

* {
                padding: 0;
                margin: 0;
        }
        ul, ol {
                list-style: none;
        }
        a {
                text-decoration: none;
                color: #000;
        }
        .box {
                width: 100%;
                overflow: hidden;
        }
        .box p {
                float: left;
                height: 200px;
        }
        .box p:first-child {
                width: 200px;
                background-color: green;
        }
        .box p:last-child {
                width: 200px;
                background-color: green;
        }
        /*2号元素宽度自适应  计算*/
        .box p:nth-child(2) {
                /*计算*/
                width: calc(100% - 400px);
                height: 200px;
                background-color: orange;
        }

        </style>
</head>
<body>
        <div class="box">
                <p>1</p>
                <p>2</p>
                <p>3</p>
        </div>
</body>


固比固的弹性盒

1        .box {
2                /*父盒子设置弹性盒容器*/
3                width: 100%;
4                display: -webkit-flex;
5                /*子盒子自动并排显示 不需要设置浮动*/
6        }
7        .box p:first-child {
8                width: 200px;
9                height: 200px;
10                background-color: lightblue;
11        }
12        .box p:nth-child(2) {
13                /*宽度自适应*/
14                -webkit-flex: 2222;
15                height: 200px;
16                background-color: green;
17        }
18        .box p:last-child {
19                width: 200px;
20                height: 200px;
21                background-color: orange;
}

---------------------
【转载,仅作分享,侵删】
作者:前端小99
原文:https://blog.csdn.net/qq_41328247/article/details/88725162
版权声明:本文为博主原创文章,转载请附上博文链接!

1 个回复

倒序浏览
奈斯,感谢分享
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马