我的页眉左侧有一个间距,我很难摆脱它。如果有人可以帮助我,我将不胜感激。下面是我的 html 和 css。
HTML
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css"/>
<title></title>
</head>
<body>
<Header>
<div id="logo"></div>
<nav>
<ul>
<li><a href="index.html">home</a></li>
<li><a href="about.html">about me</a></li>
<li><a href="portfolio.html">portfolio</a></li>
<li><a href="blog.html">blog</a></li>
<li><a href="contact.html">contact</a></li>
</ul>
</nav>
</Header>
</body>
</html>
CSS
body{
width: 100%;
}
header{
margin: 0;
padding: 0;
width: 100%;
height: 77px;
background: #cccccc;
}
#logo{
float: left;
}
nav{
float: left;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
li{
display: inline;
}
最佳答案
我必须在 css 中为我的正文添加 margin:0。
关于html - 页眉左侧不需要的空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26447039/