Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
Problem with html/css margin?
Hi
I want to get rid of the white margin on the attached test website, above/below the "cool website" part, although cannot find where it is. Can someone please advise? CSS pasted below
<html>
<head>
<title>All About Music</title>
<link rel="stylesheet" href="css.css">
<meta name="description" content="This is a page about guitarists"/>
</head>
<body>
<header>
<h1>Cool Website</h1>
</header>
<nav>
<ul>
<a href="hash"><li>Home</li></a>
<a href="hash"><li>About Us</li></a>
<a href="hash"><li>News</li></a>
<a href="hash"><li>Blog</li></a>
<a href="hash"><li>Contact</li></a>
<a href="hash"><li>Feedback</li></a>
</ul>
<div class="handle">Menu</div>
</nav>
body {
margin: 0;
padding: 0;
font-family: sans-serif;
}
header {
background: hash00795f;
width: 100 pc
padding: 40hash 0;
color: white;
text-align: center;
}
a {
color: inherit;
text-decoration: none;
}
nav ul {
background-color: hash43a286;
overflow: hidden;
color: white;
padding: 0;
text-align: center;
margin: 0;
}
nav ul li {
display: inline-block;
padding: 20px;
margin: 0;
}
nav ul li:hover {
background: hash399077;
}
section {
line-height: 1.5em;
font-size: 0.9em;
padding: 40px;
width: 75 pc;
margin: 0 auto;
}
.handle {
width: 100 pc
background: hash005c48;
text-align: left;
box-sizing: border-box;
padding: 15px 10px;
cursor: pointer;
display: none;
}

2 Answers
- ChrisLv 74 years agoFavorite Answer
It's the margin of the <h1> in your <header>.
I also cleaned up the nav nonsense: https://jsfiddle.net/khrismuc/k1d2j6pw/
(If you must use ul/li for your navigation, you have to put the <a>s inside the <li>s, not the other way around.)
- ?Lv 74 years ago
header {
margin: -15px 0 -14px 0;
background: #00795f;
color: white;
text-align: center;
}