如何在菜单标题和文本正文之间留出空格? 这也是一个好习惯吗?
div.body
{
width: 6.5in;
margin:0px auto;
text-align:left;
}
.menu ul{
margin:0px auto;
}
.menu li{
width: 25%;
text-align:center;
display:block;
float:left;
}
.menu a{
display:block;
}
HTML:
<html>
<head>
<link rel="stylesheet" type="text/css" href="my.css" />
</head>
<body>
<div>
<div class="menu">
<ul>
<li><a href="">Home</a></li>
<li>Test</li>
<li>Test 2</li>
<li>Contact</li>
</ul>
</div>
</div>
<div class="body">
lots of textlots of textlots of textlots of textlots of textlots of textlots of textlots of text
<the above repeated many times>
</div>
</body>
</html>
答案 0 :(得分:1)
设置文本正文的上边距:
div.body
{
width: 6.5in;
margin: 10px auto 0px auto;
text-align: left;
}