right寬度自適應為什么寬度很小
這是我寫出來的代碼:(為什么右邊的right不設置寬度的話,自適應寬度很???)
<html> <head> <style?type="text/css"> body?{margin:0;?padding:0;?font-size:30px;} .top?{height:100px;?background:pink;} .main?{width:800px;?height:600px;?background:red;} .left?{width:200px;?height:600px;?background:blue;?float:left;} .right?{height:600px;?background:orange;?float:right;} .foot?{width:800px;?height:50px;?background:green;} </style> </head> <body> <div?class="top">top</div> <div?class="main"> ??<div?class="left">left</div> ??<div?class="right">right</div> </div> <div?class="foot">foot</div> </body> </html>
2016-07-18
因為自適應是默認以容器內的內容來適應的,而你的內容只有文字,所以就寬度很小了。
2016-07-18
你沒有在`main`里面設置`margin`。而且你`mian`里面的`width`也不是100%