导航栏无法达到1002像素的宽度,求解

Fairstay 2011-07-26 06:52:59
是这样的,我刚学div+css,现在在网上找了一个导航条,可是无法将其宽度设置成1002大小的,求解

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>中国</title>
<style type="text/css">
body {
margin:0;
padding:0;
font: bold 21px/1.5em Verdana;
}
img {
border: none;
}
/*- Menu Tabs 8--------------------------- */

#tabs8 ul {
margin:0;
padding:1px 10px 0 50px;
list-style:none;
}
#tabs8 li {
display:inline;
margin:0;
padding:0;
}
#tabs8 a {
float:left;
background:url("tableft8.gif") no-repeat left top;
margin:0;
padding:0 0 0 4px;
text-decoration:none;
}
#tabs8 a span {
float:left;
display:block;
background:url("tabright8.gif") no-repeat right top;
padding:5px 15px 4px 6px;
color:#333;
}
/* Commented Backslash Hack hides rule from IE5-Mac \*/
#tabs8 a span {float:none;}
/* End IE5-Mac hack */
#tabs8 a:hover span {
color:#591333;
}
#tabs8 a:hover {
background-position:0% -42px;
}
#tabs8 a:hover span {
background-position:100% -42px;
}
</style>
</head>
<body>
<div id="tabs8">
<ul>
<li><a href="#" ><span> 市局主页 </span></a></li>
<li><a href="#" ><span> 网站首页 </span></a></li>
<li><a href="#" ><span> 刑大简介 </span></a></li>
<li><a href="#" ><span> 刑事技术 </span></a></li>
<li><a href="#" ><span> 视频点播 </span></a></li>
<li><a href="#" ><span> 图片新闻 </span></a></li>
<li><a href="#" ><span> 值 班 表 </span></a></li>
<li><a href="#" ><span> 通 讯 录 </span></a></li>
</ul>
</div>
</body>
</html>
...全文
367 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
lsw645645645 2011-07-26
  • 打赏
  • 举报
回复
加个样式啊:

#tabs8
{
width:100%;
background:#eee;
height:80px;
}
MuBeiBei 2011-07-26
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 fairstay 的回复:]
主要让它能平铺下来即可,我是这个思路,但是不会解决
[/Quote]

你说是图片?
主要是我着看不到你加的这些gif图。所以看不到整体效果
Fairstay 2011-07-26
  • 打赏
  • 举报
回复
主要让它能平铺下来即可,我是这个思路,但是不会解决
Fairstay 2011-07-26
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 mubeibei 的回复:]

HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equi……
[/Quote]
谢谢,不过还是没有效果,我期望的两边能靠边,虽然定义了,但是浏览器上还是不靠边,仍然在中间
MuBeiBei 2011-07-26
  • 打赏
  • 举报
回复
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>中国</title>
<style type="text/css">
body {
margin:0;
padding:0;
font: bold 21px/1.5em Verdana;
}
img {
border: none;
}
/*- Menu Tabs 8--------------------------- */
#tabs8{width:100%; min-width:1002px;}
#tabs8 ul {

list-style:none;

}
#tabs8 li {
display:inline;
margin:0;
padding:0;

}
#tabs8 a {
float:left;
background:url("tableft8.gif") no-repeat left top;
margin:0;
padding:0 0 0 4px;
text-decoration:none;
}
#tabs8 a span {
float:left;
display:block;
background:url("tabright8.gif") no-repeat right top;
padding:5px 15px 4px 6px;
color:#333;
}
/* Commented Backslash Hack hides rule from IE5-Mac \*/
#tabs8 a span {float:none;}
/* End IE5-Mac hack */
#tabs8 a:hover span {
color:#591333;
}
#tabs8 a:hover {
background-position:0% -42px;
}
#tabs8 a:hover span {
background-position:100% -42px;
}
</style>
</head>
<body>
<div id="tabs8">
<div style="width:1002px; margin:0 auto;">
<ul>
<li><a href="#" ><span> 市局主页 </span></a></li>
<li><a href="#" ><span> 网站首页 </span></a></li>
<li><a href="#" ><span> 刑大简介 </span></a></li>
<li><a href="#" ><span> 刑事技术 </span></a></li>
<li><a href="#" ><span> 视频点播 </span></a></li>
<li><a href="#" ><span> 图片新闻 </span></a></li>
<li><a href="#" ><span> 值 班 表 </span></a></li>
<li><a href="#" ><span> 通 讯 录 </span></a></li>
</ul>
</div>
</div>
</body>
</html>



试试
Fairstay 2011-07-26
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 hongmei85 的回复:]
这样?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv=……
[/Quote]
没有用,导航条还是居中,左右都有空
hongmei85 2011-07-26
  • 打赏
  • 举报
回复
这样?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>中国</title>
<style type="text/css">
body {
margin:0;
padding:0;
font: bold 21px/1.5em Verdana;
}
img {
border: none;
}
/*- Menu Tabs 8--------------------------- */

#tabs8{width:1002px;background-color:#f00;}
#tabs8 ul {
margin:0;
padding:1px 10px 0 50px;
list-style:none;
}
#tabs8 li {
display:inline;
margin:0;
padding:0;
}
#tabs8 a {
float:left;
background:url("tableft8.gif") no-repeat left top;
margin:0;
padding:0 0 0 4px;
text-decoration:none;
}
#tabs8 a span {
float:left;
display:block;
background:url("tabright8.gif") no-repeat right top;
padding:5px 15px 4px 6px;
color:#333;
}
/* Commented Backslash Hack hides rule from IE5-Mac \*/
#tabs8 a span {float:none;}
/* End IE5-Mac hack */
#tabs8 a:hover span {
color:#591333;
}
#tabs8 a:hover {
background-position:0% -42px;
}
#tabs8 a:hover span {
background-position:100% -42px;
}
</style>
</head>
<body>
<div id="tabs8">
<ul>
<li><a href="#" ><span> 市局主页 </span></a></li>
<li><a href="#" ><span> 网站首页 </span></a></li>
<li><a href="#" ><span> 刑大简介 </span></a></li>
<li><a href="#" ><span> 刑事技术 </span></a></li>
<li><a href="#" ><span> 视频点播 </span></a></li>
<li><a href="#" ><span> 图片新闻 </span></a></li>
<li><a href="#" ><span> 值 班 表 </span></a></li>
<li><a href="#" ><span> 通 讯 录 </span></a></li>
</ul>
</div>
</body>
</html>
Fairstay 2011-07-26
  • 打赏
  • 举报
回复
我希望的结果就是导航条的左右能正好抵到浏览器边框,可是用css我不知道如何实现这个效果

61,125

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧