身体标签和第一个div之间的差距

时间:2013-11-21 22:53:24

标签: html margin doctype

我知道为什么我的容器div之间存在间隙。我使用CSS重置身体和HTML,但差距仍然存在。 问题只有在我删除第一行(!doctype html)后才解决?可能是什么问题?

<!doctype html>
<html lang="en" dir="ltr">
<head>
   <title>Home Page</title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   <meta name="description" content="Testing web site">
   <link type="text/css" rel="stylesheet" href="css/pms01.css">
<style type="text/css">
</style>
</head>
<body>
<div id="container">
<div id="header">
    <h1>Hello </h1>
</div>
</div></body>

这是CSS:

html, body {
margin:0px;
padding:0px;
font-family:"Times New Roman", Geneva, sans-serif;}

#container{
border:solid 3px #CCC;}
#container h1{
font-family:Georgia, "Times New Roman", Times, serif;
margin:0px;
padding:0px;
font-size:16px;}
#header{
margin:2px 0px;
padding:2px;
background-color:#26469B;}

0 个答案:

没有答案