我想对齐 3 个 div。其中两个具有固定宽度,右侧一个具有自动宽度以填充右侧的空白区域。
有什么提示吗?
这是我的例子:
<div id="container" style="width:100%; background-color:Red;">
<div id="left" style="width:100px; height:400px; background-color: yellow; float:left; display:inline-block">
</div>
<div id="center" style="width:600px; height:400px; background-color: blue; float:none; display:inline-block">
</div>
<div class="right" style=" height:400px; width:auto;background-color: green; float:right; display:inline-block">
</div>
</div>
最佳答案
你可以这样写:
CSS:
.fixed{
height:40px;
width:40px;
float:left;
background:green;
}
.fuild{
overflow:hidden;
height:40px;
background:red;
}
div{
border:1px solid yellow;
}
HTML
<div class="fixed">1</div>
<div class="fixed">2</div>
<div class="fuild">3</div>
关于html - 对齐 3 个 div。其中 2 个宽度为固定宽度,第三个为自动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10381906/