Open GenXiaoLe opened 5 years ago
<body>
<div class='content'>
<div class="left"></div>
<div class="right"></div>
</div>
</body>
<style>
.content {
overflow: hidden;
width: 100%;
border: 1px solid pink;
}
.left {
float: left;
width: 100px;
height: 100px;
border: 1px solid #000;
}
.right {
height: 100px;
border: 1px solid red;
}
</style>
<body>
<div class='content'>
<div class="left"></div>
<div class="right"></div>
</div>
</body>
<style>
.content {
display: flex;
border: 1px solid pink;
}
.left {
width: 100px;
height: 100px;
border: 1px solid #000;
}
.right {
flex: 1;
height: 100px;
border: 1px solid red;
}
</style>
<body>
<div class='content'>
<div class="left"></div>
<div class="right"></div>
</div>
</body>
<style>
.content {
width: 100%;
border: 1px solid pink;
}
.left {
width: 100px;
height: 100px;
float: left;
background: blue;
}
.right {
width: 100%;
background: red;
height: 100px;
}
</style>
<body>
<div class='content'>
<div class="left"></div>
<div class="right"></div>
</div>
</body>
<style>
* {
margin: 0;
padding: 0;
font-size: 0;
}
.content {
width: 100%;
border: 1px solid pink;
}
.left {
width: 100px;
height: 100px;
display: inline-block;
background: blue;
}
.right {
width: calc(100% - 100px);
background: red;
display: inline-block;
height: 100px;
}
</style>
<body>
<div class='outside'>
<div class="left"></div>
<div class="right"></div>
</div>
</body>
<style>
.outside {
width: 100%;
height: 300px;
position: relative;
}
.left {
width: 100px;
height: 100%;
background: blue;
}
.right {
position: absolute;
left: 100px;
right: 0;
top: 0;
bottom: 0;
background: red;
}
</style>
也可以使用margin 为负值实现