DIV为什么出现不该有的间距

来源:百度知道 编辑:UC知道 时间:2024/07/03 03:04:43
以下是我的代码

<!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=utf-8" />
<title>无标题文档</title>
</head>
<!--图片 宽为200 高为11-->
<body style="margin:0;padding:0;">
<div style="width:224px;height:auto;background-color:#F00;margin:0;padding:0;">
<div style="background:url(image/userinfo_04.jpg) 0 0 no-repeat;height:11px;padding:0;margin:0;"></div>
<div style="height:200px;background-color:#06F;padding:0;marg

你用的是IE6吧
在你设置了背景图片的那个层里加入
<img width="0px" height="11px;"/>
这个代码

如下
<div style="background:url(image/userinfo_04.jpg) 0 0 no-repeat;height:11px;padding:0;margin:0;">
<img width="0px" height="11px;"/>
</div>

就解决了

没看到间距,发个图看看?