我想建立一个导航栏,但是我在实现删除边距的解决方案时遇到了问题,但它只从我的主页中删除了边距。
我尝试了一些建议,包括这个问题中排名最高的建议,但仍然没有用。
CSS:
/**********************************
HEADING
**********************************/
header {
float: left;
margin: 0 0 30px 0;
padding: 5px 0 0 0;
width: 100%;
background-color: #f00;
}
#logo {
text-align: center;
margin: 0;
}
/**************************
GENERAL
**************************/
body {
background-color: grey;
margin: 0;
padding: 0;
}
a {
text-decoration: none;
}
/**********************************
NAVIGATION
**********************************/
nav {
text-align: center;
padding: 10px 0;
margin: 20px 0 0;
background-color: #fff;
}
nav ul {
list-style: none;
margin: 0 10px;
padding: 0;
}
nav li {
display: inline-block;
}
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>AP World</title>
<meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">
<link rel="stylesheet" href="/css/main.css">
<link rel="canonical" href="http://yourdomain.com/">
</head>
<body>
<header>
<a href="" id="logo">
<h1>AP World</h1>
</a>
<nav>
<ul>
<li><a href="/index.html">Home</a>
</li>
<li><a href="/songs">Songs</a>
</li>
<li><a href="/virgins">Virgins</a>
</li>
</ul>
</nav>
</header>
<div class="page-content">
<div class="wrapper">
Homepage
</div>
</div>
</body>
</html>
这里是我的网站链接:https://jekyll-mikehovet.c9.io/index.html,还有一个JSFiddle链接:http://jsfiddle.net/BradleyIW/f5sh8usj/
我对网站开发还比较新手,所以非常感谢任何帮助!^^
H1
标签的边距上。 - APAD1clearfix
,您可以在此处阅读有关此主题的更多信息。 - APAD1