我有三個div標籤,我想在div標籤之間垂直放置空間,也希望我的第一個div標籤是固定的。如何在div標籤之間製作垂直空間?
當我把我的第一個div位置不是一個固定的一個,我可以能夠使垂直空間。
<html>
<head>
<title>div</title>
</head>
<body style="margin: 0; padding: 0;">
<div style="width:100%; background-color:Lime;">
<div style="width:100%; height:10%; background-color:Blue;">
a
</div>
<div style="width:70%; height:100%; background-color:Gray; margin: auto; margin-top: 2em; margin-bottom: 2em;">
b
</div>
<div style="width:100%; height:5%; background-color:Aqua;">
c
</div>
</div>
</body>
</html>
當我改變我的「分區一」位置固定,既「分區一」和「格B」來自於保證金自上而下:2em的。
<html>
<head>
<title>div</title>
</head>
<body style="margin: 0; padding: 0;">
<div style="width:100%; background-color:Lime;">
<div style="width:100%; height:10%; background-color:Blue; position: fixed;">
a
</div>
<div style="width:70%; height:100%; background-color:Gray; margin: auto; margin-top: 2em; margin-bottom: 2em;">
b
</div>
<div style="width:100%; height:5%; background-color:Aqua;">
c
</div>
</div>
</body>
</html>
請幫助我,使我「分區一」爲固定並作出空間之間「分區a和b」。
感謝您的回答。這是非常明確的解釋。 :) – Sivaprakash 2014-10-08 06:48:08