使用CSS樣式 clear:both 實現div不並排

來源:互聯網
上載者:User

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title>
<style type="text/css">
#wai{
 width:500px;
 height:500px;
 background-color: #990;
}

#nei {
 float:left;
 width:200px;
 height:200px;
 background:#FFF;
}
body {
 margin-left: 0px;
 margin-top: 0px;
 margin-right: 0px;
 margin-bottom: 0px;
}
</style>
</head>

<body>
<div id="wai">
<div id="nei">我在左邊</div>
<div style="clear:both">我不在右邊</div><!--刪除紅色的字看看-->
</div>
</body>
</html>

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.