如何为浮动框对应的框提供边距?这是我的源代码:
<!DOCTYPE html>
<html>
<head>
<title>Boxes</title>
<link rel="stylesheet" type="text/css" href="intro.css">
</head>
<body>
<div id="page">
<div id="header">
<h3 class="welcome">Welcome</h3>
<h5 class="welcome">to</h5>
<h1 class="welcome" style="color:green;font-family:cursive">Tamim's</h1>
<h5 class="welcome">page</h5>
</div>
</div>
<div class="navigation">
<ul>
<li>home</li>
<li>photos</li>
<li>important-links</li>
<li>facebook</li>
</ul>
</div>
<div id="left">
<img src="408528_10200574301423959_1609852992_n.jpg">
</div>
<div id="right"></div>
<div id="test"></div>
</div>
</body>
</html>
和
#page{
min-width:360px;
margin: 10px auto 10px auto;
background-color: rgb(32,127,224);
padding: 20px;
border: 2px solid black;
box-shadow: inset 0px 0px 10px #777777;
border-radius: 5px;
}
#header{
width: 360px;
margin: 0px auto 0px auto;
text-align: center;
}
.welcome{
margin: auto;
text-align: center;
display: inline;
}
#left{
width: auto;
margin-top: 10px;
float: left;
border: 2px inset red;
padding: 10px;
border-radius: 5px;
background-color: rgb(157,160,146);
height: 425px;
}
#right{
float: right;
margin-top: 10px;
margin-left: 30px;
margin-right: 30px;
border: 2px solid green;
border-radius: 5px;
height: 425px;
width: 67%;
background-color: rgb(121,241,240);
}
.navigation{
padding: 1px 3px 3px 3px;
margin: 20px auto 20px auto;
width: 500px;
height: 40px;
background-color: red;
border-radius: 5px;
text-align: center;
}
.navigation li{
margin: 3px 6px 3px 6px;
display: inline;
border: 2px solid black;
padding: 2px;
zoom:1;
width:auto;
}
#test{
margin: 5px 5px 5px 5px;
height: 100px;
background-color: black;
clear: both;
border-radius: 5px;
}
现在当我给顶部一个边距时,它不是低于左边还是右边?我如何给左边的边距?还有为什么我的#lefts
身高比对的大?但是我给了它们相同的高度 425px。?