CSS 2 Div布局浮动 [英] CSS 2 Div Layout float

查看:83
本文介绍了CSS 2 Div布局浮动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有点尴尬的问题,但至少在过去的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向左浮动,固定宽度为75px Div 2向右浮动,固定宽度为900px

Need 2 div layout. Div 1 floated left with a fixed width of 75px Div 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布局浮动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆