h标签看不到margin
时间:2010-09-18
来源:互联网
复制内容到剪贴板
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<style type="text/css" media="all">
*{padding:0px; margin:0px; font-size:12px; font-family:Arial, Helvetica, sans-serif,"宋体"}
.clear{clear:both}
img{ border:0px}
/*我设置box的大小,并设置padding-top=50px,我想在它里面放一个h标签,设置它上边距margin为5px,我发现在IE78标准,但在IE6里发现只有当h的margin大于上面的padding时候(>50px)才能看到margin??!!当然我是可以把盒子的padding-top改大一点就没事了不去设置h的margin,有谁知道这是为什么吗???????*/
#show{
margin:10px auto;
width:180px;
height:300px;
background:url(login.jpg) no-repeat center top #009999;
padding-top:50px;
}
h2{
margin:5px 10px;
}
</style>
<body>
<div id="show"><h2>测试</h2></div>
</body>
</html>
代码:
<!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>
</head>
<style type="text/css" media="all">
*{padding:0px; margin:0px; font-size:12px; font-family:Arial, Helvetica, sans-serif,"宋体"}
.clear{clear:both}
img{ border:0px}
/*我设置box的大小,并设置padding-top=50px,我想在它里面放一个h标签,设置它上边距margin为5px,我发现在IE78标准,但在IE6里发现只有当h的margin大于上面的padding时候(>50px)才能看到margin??!!当然我是可以把盒子的padding-top改大一点就没事了不去设置h的margin,有谁知道这是为什么吗???????*/
#show{
margin:10px auto;
width:180px;
height:300px;
background:url(login.jpg) no-repeat center top #009999;
padding-top:50px;
}
h2{
margin:5px 10px;
}
</style>
<body>
<div id="show"><h2>测试</h2></div>
</body>
</html>
作者: myselfdo 发布时间: 2010-09-18
为什么要 #show里设 padding-top 而h2还margin
#show{
margin:10px auto;
width:180px;
height:300px;
background:url(login.jpg) no-repeat center top #009999;
}
h2{
margin:55px 10px 5px 10px;
}
#show{
margin:10px auto;
width:180px;
height:300px;
background:url(login.jpg) no-repeat center top #009999;
}
h2{
margin:55px 10px 5px 10px;
}
作者: cjj 发布时间: 2010-09-18
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28