布局
两栏布局(左侧定宽,右侧自适应)
思路1:左侧给定宽度,左浮动,右侧盒子添加overflow:auto,形成自身的BFC容器,自适应;
思路2:左侧定宽,设置position:absolute脱离文档流,右侧盒子设定margin-left宽度为左侧盒子的宽度,高度100%,自适应;
思路3:flex布局,包裹一个外层flex容器,左侧元素设定宽度,右侧盒子设定flex的属性值为1:
<html>
<head>
<title>Document</title>
<style>
#parent{
height:500px;
width:100%;
display: flex;
flex-flow: row;
}
#l{
width:200px;
margin:20px;
border: 1px solid #cec;
}
#r{
flex: 1;
margin:20px;
border: 1px solid blue;
}
</style>
</head>
<body>
<div id="parent">
<div id="l"></div>
<div id="r"></div>
</div>
</body>
</html>