【发布时间】:2014-06-09 16:48:30
【问题描述】:
我有两个要浮动在同一行上的 div。在窗口宽度达到 250 像素左右之前,我不希望正确的换行。
我将 div 的初始宽度设置为百分比,这似乎会导致问题。右边的 div 在缩小到 100px 的最小宽度之前会换行;
<div id="#container">
<div id="left">
<div id="box"></div>
</div>
<div id="right">
<h1>Hello World</h1>
</div>
</div>
#container {
display: table;
width: 100%;
}
#box {
width: 100px;
height: 100px;
background: gray;
display: inline-block;
max-width: 100%;
}
#left {
float: left;
width: 23.6%;
min-width:150px;
background: gold;
text-align: center;
}
#right {
float: left;
width: 76.4%;
min-width:100px;
background: pink;
}
【问题讨论】:
标签: css positioning