我有2个div:页面左侧有一个,右侧是一个。左侧的一个宽度固定,我希望右侧的一个填充剩余空间。
#search {
width: 160px;
height: 25px;
float: left;
background-color: #ffffff;
}
#navigation {
width: 780px;
float: left;
background-color: #A53030;
}
<div id="search">Text</div>
<div id="navigation">Navigation</div>
Simplest solution is to just make the left div width equal 100% - the width of the right div plus any margin between them.
https://codepen.io/tamjk/pen/dybqKBN