实例代码
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.header{
background-color:red;
text-align:center;
width:960px;
padding:10px 0px;
margin:10px auto 0px;
}
h1{
margin:30px 0px;
}
.div-a{
background-color:black;
width:960px;
margin:0px auto 0px;
}
.div-a a{
text-decoration:none;
color:white;
display:inline-block;
padding:15px 5px;
}
.div-a a:hover{
background-color:#ddd;
color:black;
}
</style>
</head>
<body>
<div class="header">
<h1>Header</h1>
</div>
<div class="div-a">
<a href="#">Home</a>
<a href="#">download</a>
<a href="#">about</a>
</div>
</body>
</html>
运行效果:
评论