我对我的简单网络感到疯狂。页面顶部和我的图像之间有一个无法解释的空间。有人能解释一下为什么吗?
我的HTML
<body>
<img src="img/top.png" border="0" />
我的css
<style type="text/css">
/* --------- demo presentation------------ */
body {text-align: center;}
#header {margin-top:0px; height: 100px; width:800px; margin:0px auto; background: #000;}
#header p {text-align:center; font-style:italic; color:#fff; font-family:Cambria; font-size:30px;}
#primary .obsah, #content .obsah, #secondary .obsah {text-align:justify; font-family:Cambria; color:#E6E8E1; font-size:15px; }
#primary p:hover, #content p:hover, #secondary p:hover {color:black;}
a{color:#E6E8E1;}
a:hover{color:black;}
#footer {padding:5px; height: 20px; width:800px; margin:0px auto; background: #000; color:#fff; font-family:Cambria; font-size:25px;}
/* --------------------------------------- */
/* ----- set width and center layout ----- */
#container {
width:800px;
margin:20px auto;
}
/* --------------------------------------- */
/* ----------- float columns ------------- */
#primary, #content, #secondary {
float:left;
width:266.667px;
height:auto;
padding: 50px 0;
background-color:#fff;
font-family:Cambria;
color:#E6E8E1;
text-align:justify;
}
#primary:hover, #content:hover, #secondary:hover {
color:black;
}
#primary a:hover{
color:black;
}
/* --------------------------------------- */
/* --------------------------------------- */
#footer {
clear:both;
}
/* --------------------------------------- */
</style>
提前致谢。
答案 0 :(得分:5)
您所看到的是body
上的默认保证金。只需将此规则添加到样式的顶部:
html, body {
margin: 0;
padding: 0;
}