Home  >  Article  >  Web Front-end  >  求问一个简单的div浮动问题_html/css_WEB-ITnose

求问一个简单的div浮动问题_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:38:471051browse

小弟刚学CSS的float,,想第二个div在第一个div的右边,第三个div在第一个div的下边,代码如下,但是出现了第三个div把第二个div覆盖了,为什么?

<body>	<div id="div_1" style="float:left">    风风风风风风风f风    </div>    	<div id="div_2">    火火火火火火火火    </div>    	<div id="div_3">    水水水水水水水水    </div></body>


结果显示:


回复讨论(解决方案)

给#div_2也加个左浮动吧

给#div_2也加个左浮动吧


给div_2加了左浮动后发现第三个div的边框和背景没了……


给#div_2也加个左浮动吧


给div_2加了左浮动后发现第三个div的边框和背景没了……
第一个和第二个左浮动
第三个clear: both;
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn