问题描述
有点尴尬的问题,但至少在过去的1个小时里,我一直在玩弄它,而且无法正确获取它.
kind of embarrassing to ask but I have been toying with it for the past 1 hour at least and cannot get it correctly.
需要2格布局.Div 1向左浮动,固定宽度为75pxDiv 2向右浮动,固定宽度为900px
Need 2 div layout.Div 1 floated left with a fixed width of 75pxDiv 2 floated right with a fixed width of 900px
现在是问题:div1-div2和div2-右外边缘之间的边距必须相等.
Now the problem: the margin between div1-div2 and div2-right outer edge needs to be equal.
推荐答案
尝试将"div 2"放入未浮动的容器中.然后删除"div 2"的浮点,而使用display:inline-block
.将text-align:center
添加到"div 2"的新容器中.
Try putting "div 2" in a container that isn't floated. Then remove "div 2"'s float and instead use display:inline-block
. Add text-align:center
to the new container of "div 2".
这篇关于CSS 2 Div布局浮动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!