您好,这是我需要构建的:样机
我停留在导航栏,这里是 CSS:
/* CSS 文档 */
body {background:#fff url(bg.jpg) repeat-x; margin:0; padding:0; height:1800px; font- family:Arial, Helvetica, sans-serif;}
#wrapper {width: 1000px; margin: 0 auto;}
#header {height: 400px; width: 1000px; display: block; position: relative; }
#header .logo {position: absolute; width: 374px; height: 221px; display: block; float: left; cursor: pointer; background: url(logo.png) 0 0 no-repeat transparent; top: 55px; left: 10px;}
#header .contact-info {position: absolute; width: 293px; height: 133px; display: block; float: left; cursor: pointer; background: url(contact-info.png) 0 0 no-repeat transparent; top: 100px; left: 700px;}
ul.mn {
position: absolute;
float: left;
top: 316px;
width: 316px;
margin: 0;
padding: 0;
list-style-type: none;
}
ul.mn li {
float: left;
}
ul.mn li a {
display: block;
float: left;
height: 73px;
margin-left: 6px;
}
ul.mn li a.mn1 {
width: 104px;
background-image: url('mn1.png');
background-position: 0 0;
}
ul.mn li a.mn2 {
width: 212px;
background-image: url('mn2.png');
}
ul.mn li a.active, ul.mn li a:hover {
background-position: 0 73px;
}
和 HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>RW-Fliesen</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="wrapper">
<div id="header_wrapper">
<div id="header">
<a href="index.html" class="logo" title="Logo"></a>
<div class="contact-info" title="contact-info"></div>
<ul class="mn">
<li><a href=" " title="" class="mn1 "></a></li>
<li><a href=" " title="" class="mn2 "></a></li>
</ul>
</div>
</div>
</div>
</body>
</html>
当我只有一个导航元素时看起来一切都很好:只有一个元素的导航
但是当我添加第二个导航元素时,Navi 看起来像这样:Navi with more than one element
我们该如何解决?