Html 使浮动div';s的位置不受其内容的影响,不设置宽度
我想做这个布局,div2的宽度不会受其内容的影响Html 使浮动div';s的位置不受其内容的影响,不设置宽度,html,css-float,Html,Css Float,我想做这个布局,div2的宽度不会受其内容的影响 ----------------------------------------- | | | div1 | | div2 | | | | ----------------------------------------- 这是我的密码: <html&g
-----------------------------------------
| | |
div1 | | div2 |
| | |
-----------------------------------------
这是我的密码:
<html>
<body>
<div style="background:red;height:200px;">
<div style="background:black;width:100px;float:left;height:100px;">
</div>
<div style="background:green;height:50px;float:left;margin:10px;">
when here the content is too much, this div will start another line,
which is not wanted, I want this div to be float always, also , I dont know the with.
</div>
</div>
<body>
</html>
当这里的内容太多时,这个div将开始另一行,
这是不需要的,我希望这个div永远是浮动的,而且,我不知道它的用途。
那么,如何 添加css属性
max-width:100px
我有一个解决方案:制作第二个div
style=“background:green;height:50px;margin left:110px;”
如果我不知道第一个div的宽度,是否还有其他解决方案可能重复:。