关于CSS样式排版问题

yum56 2014-03-28 12:40:45
帮我看一下这代码有问题吗:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<title>新建网页</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
#container{
width:975px;
}
#header{
height:292px;
background:url(./images/index_01.gif);
}
#nav{
width:975px;

}
#navl{
width:286px;
height:118px;
margin:0px;
float:left;
background: url(./images/index_02.gif);


}
#navm{
width:400px;
height:118px;
margin:0px;
float:left;
background:url(./images/index_03.gif);
}
#navr{
width:289px;
height:118px;
margin:0px;
float:left;
background:url(./images/index_04.gif);
}


</style>
</head>
<body>
<div id="container">
<div id="header"></div>
<div id="nav">
<dir id="navl"></dir>
<dir id="navm"></dir>
<dir id="navr"></dir>
</div>

</div>
</div>
</body>
</html>
显示的结果为什么会这样

这三张图片尺寸都没错,为什么都会多出一一边,导致并排不下多出一行?
#nav{
width:975px;

}
#navl{
width:286px;
height:118px;
margin:0px;
float:left;
background: url(./images/index_02.gif);


}
#navm{
width:400px;
height:118px;
margin:0px;
float:left;
background:url(./images/index_03.gif);
}
#navr{
width:289px;
height:118px;
margin:0px;
float:left;
background:url(./images/index_04.gif);
}


...全文
128 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
chenxiao1027 2014-03-30
  • 打赏
  • 举报
回复
在三个图片DIV样式里加 padding:0px; 用FIREFOX 的firebug布局看下就知道了嘛

61,112

社区成员

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

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