<!DOCTYPE html>
<html>
<head>
<meta http-equiv ="Content-Type" content="text/html; charset=utf-8">
<title>二级分层导航栏</title>
</head>
<style type="text/css">
body{
text-align: center;/*这里和下面的margin: 0 auto;共同控制居中*/
}
#headNav{
margin: 0 auto;
height: 80px;
width: 600px;
border: 1px solid #f00;
}
#mainNav{
margin: 0 auto;
top: 2px;
height: 30px;
width: 800px;
}
.mainItem{
float: left;//导致横列
top: 3px;
height: 27px;
width: 74px;
padding: 10px 0px;
margin: 5px 10px; //这一行控制每个导航块的大小
text-align: center;
font-size: 13px;
background-image: url(img/1.jpg);
background-repeat: no-repeat;
}
.subItemNav{
position: absolute;
top: 60px;
width: 500px;
height: 30px;
padding: 2px 0px 0px 50px;
margin: 3px 10px;
visibility: hidden;
background-color: #61B38B;
}
.subItemNav a:link,.subItemNav a:visited{
font-size: 80%;
color: #ffffff;
}
<html>
<head>
<meta http-equiv ="Content-Type" content="text/html; charset=utf-8">
<title>二级分层导航栏</title>
</head>
<style type="text/css">
body{
text-align: center;/*这里和下面的margin: 0 auto;共同控制居中*/
}
#headNav{
margin: 0 auto;
height: 80px;
width: 600px;
border: 1px solid #f00;
}
#mainNav{
margin: 0 auto;
top: 2px;
height: 30px;
width: 800px;
}
.mainItem{
float: left;//导致横列
top: 3px;
height: 27px;
width: 74px;
padding: 10px 0px;
margin: 5px 10px; //这一行控制每个导航块的大小
text-align: center;
font-size: 13px;
background-image: url(img/1.jpg);
background-repeat: no-repeat;
}
.subItemNav{
position: absolute;
top: 60px;
width: 500px;
height: 30px;
padding: 2px 0px 0px 50px;
margin: 3px 10px;
visibility: hidden;
background-color: #61B38B;
}
.subItemNav a:link,.subItemNav a:visited{
font-size: 80%;
color: #ffffff;
}