左侧元素固定宽;右侧元素宽自适应

<!DOCTYPE>
<html lang="en">
<style>
.one {
    float: left;
    height: 100px;
    width: 300px;
    background-color: blue;
}
.two {
    overflow: auto;//重要或者overflow:hidden;
    height: 200px;
    background-color: red;
}
</style>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <link rel="stylesheet" href="test.css" type="text/css">
</head>
<body>
    <div class="one"></div>
    <div class="two">第1种方法</div>
</body>

</html>


猜你喜欢

转载自blog.csdn.net/weixin_34849724/article/details/80999694
今日推荐