<!DOCTYPE?HTML>
<html>
<head>
<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8">
<title>浮動模型</title>
<style?type="text/css">
#div3{????
????border:5px?pink?solid;
????width:605px;
????height:20px;
????inline-block;
????background-color:Cyan;
}
?#div1,#div2{border:5px?yellow?solid;
????width:300px;
????height:80px;???
inline-block;
????background-color:chartreuse;
????float:left;}
</style>
</head>
<body>
<div?id="div3">導(dǎo)航條</div>
?
<div?id="div1">欄目1</div>
<div?id="div2">欄目2</div>
</body>
</html>
2016-01-28
在#div1,#div2中設(shè)置margin-right, margin-top屬性試試。
結(jié)果圖:
2016-01-28
margin可以設(shè)置周邊距你給的這個例子的話只要加上#div3{margin-bottom:?px}#div1{margin-bottom:?px}即可
2016-01-28
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>對齊</title>
<style type="text/css">
div{text-align:center;}
div{line-height:8em;}
</style>
</head>
<body>
<div><img src="http://img1.sycdn.imooc.com//52b4113500018cf102000200.jpg" ></div>
<div><img src="http://img1.sycdn.imooc.com//52b4113500018cf102000200.jpg" ></div>
</body>
</html>
這種不知道可以嗎?
2016-01-28
<style type="text/css">
#div3{?
margin:10px; ? /*隨便加了10px,是不是你想要的效果*/
? ? border:5px pink solid;
? ? width:605px;
? ? height:20px;
? ? inline-block;
? ? background-color:Cyan;
}
?#div1,#div2{
margin:10px; ? /*隨便加了10px,是不是你想要的效果*/
border:5px yellow solid;
? ? width:300px;
? ? height:80px; ??
? ? inline-block;
? ? background-color:chartreuse;
? ? float:left;}
</style>
2016-01-28
在#div1,#div2中設(shè)置margin-right, margin-top屬性試試。
結(jié)果圖:
2016-01-28
用一個一個大的div包括所有小的div,給大的div設(shè)置一個外邊距(margin)即可。已試驗過。
2016-01-28
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>浮動模型</title>
<style type="text/css">
#div3{ ? ?
? ? border:5px pink solid;
? ? width:605px;
? ? height:20px;
? ? inline-block;
? ? background-color:Cyan;
? ? margin-bottom: 10px;
}
?#div1,#div2{border:5px yellow solid;
? ? width:300px;
? ? height:80px; ??
? ? inline-block;
? ? background-color:chartreuse;
? ? float:left;
}
#div1{
? ? margin-right: 10px;
}
</style>
</head>
<body>
<div id="div3">導(dǎo)航條</div>
??
<div id="div1">欄目1</div>
<div id="div2">欄目2</div>
?
</body>
</html>
<!-- 使用margin就可以使用div之間的間隔-->