我想要这里的绿色区域填充绿色和蓝色区域之间的整个水平白色区域。 问题是我不知道我应该把它放在width
属性上,目前它是500px
。填充水平空间
<article id="chat">
</article>
<aside id="channel-attendees">
</aside>
chat
是左边栏,channel-attendees
正确的。
#chat {
background: green;
float: left;
height: 500px;
width: 500px;
}
#channel-attendees {
background: blue;
float: right;
width: 200px;
height: 500px;
}
为什么不用百分比表示宽度? I.E. 80%(绿色),20%(蓝色)? – 2013-03-25 23:03:52
我认为它是/看起来更好,如果侧边栏始终保持相同的宽度(就像facebook侧边栏例如) – poitroae 2013-03-25 23:06:27
好吧,那么一些解决方案可能是捕捉窗口的JS宽度,减去200px,并将结果应用到绿色领域:) – 2013-03-25 23:08:10