CSS 浮动 Div 问题
好吧,我对 CSS 实在是一窍不通。但我需要这样做。
你可以在 http://www.eresig.tk 看到我的问题,我正在尝试使用“ Lorem ipsum”和“Testing4”处于同一高度。
我不想使用绝对位置,我想用浮动来做到这一点。 编辑:我已经找到了我正在寻找的答案。
Okay, I completely suck at CSS. But I need to do it.
You can see my issue at http://www.eresig.tk, I am trying to make the div with "Lorem ipsum" and the one with "Testing4" at the same height.
I do not want to use absolute position, I want to do it with floating.
EDIT: I've got the answer I looked for.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果我正确理解你的问题,你希望测试 4 的 div 位于 Lorem ipsum 的 div 旁边。在这种情况下,您需要为您的 div 设置特定的宽度。只要您未指定宽度,它们将默认为 100%,并且测试 4 div 将低于另一个 div。
我也没有在您的 Lorem Ipsum div 上看到浮动。
If I understood your question correctly, you want the div with Testing 4 to be beside the one with Lorem ipsum. It that's the case, you need to set a specific width on your divs. As long as you leave the width unspecified, they will default to 100% and the Testing 4 div will fall below the other one.
I also didn't see a float on your Lorem Ipsum div.
我建议您阅读这篇文章:
流体宽度等高 CSS 列
I recommend that you read this posts:
Fluid Width Equal Height CSS Columns
试试这个
css:
html:
try this
css:
html:
如果我正确地回答了你的问题,
你的 CSS 应该看起来像
HTML 标记
完整的代码
*注意:我添加了
height:50px;背景颜色:黑色
查看结果。当然,您可以删除此代码这是示例
http://jsfiddle.net/QbLgu/
这是每个 Webdev 必须了解的基本知识。你需要学习基础知识。在提出有关 SO 的问题之前尝试进行研究
If I got your question correctly,
Your CSS should look like
And HTML markup
The full code
*note: I've added
height:50px; background-color:black
to see the result. You can remove this code, of courseAnd here is the example
http://jsfiddle.net/QbLgu/
This is the basic things that every webdev MUST KNOW. You need to learn basics. Try to research, before asking question on SO