2个左浮动div,当div1停止缩小时,div2开始重叠...如何防止?
我有这样的:
+--LEFTFLOATEDDIV1-+ +--LEFTFLOATEDDIV2-+ <--- screen edge
| min-width:400px | | |
| width:50% | | |
+------------------+ +------------------+
缩小浏览器窗口会使 div1 缩小,然后停在 400px,正如它应该的那样。然而,当缩小得更多时,div2 继续向左移动,覆盖 div1。我该如何防止这种情况?当 div1 停止缩小时,我希望 div2 停止移动。如何?
I have this:
+--LEFTFLOATEDDIV1-+ +--LEFTFLOATEDDIV2-+ <--- screen edge
| min-width:400px | | |
| width:50% | | |
+------------------+ +------------------+
Shrinking the browser window makes div1 shrink and then stops at 400px, as it should. However, when shrinking even more, div2 keeps moving left, overlaying div1. How do I prevent this? When div1 stops shrinking, I would like for div2 to stop moving. How?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你不能给两个 div 周围的包装器一个最小宽度吗? Div1 最小宽度为 400px,假设 Div2 宽度 = 300px,使用
min-width=700px
(+边框)制作包装器:http://jsfiddle.net/Zb5MV/
Can't you just give a min-width to a wrapper around both divs? Div1 min width is 400px, and let's say Div2 width = 300px, make a wrapper with
min-width=700px
(+borders):http://jsfiddle.net/Zb5MV/
尝试从右侧 div 中删除浮动。
Try removing the float from the right div.
只需将它们包装在容器/支架 div 中,其最小宽度等于内部 div 的最小宽度。
所以内联它看起来像这样...
不要忘记 IE6 本身不支持 min-width 。
Just wrap them in a container/holder div with a min-width that is equal to both min-width(s) of the inside divs.
So inline it would look something like this...
Don't forget min-width is not natively supported by IE6.