Can anyone explain why there is a small gap between the top navigation element and the content div that sits below it in this jsfiddle?
When I float the navigation list items, this creates a small gap between the top navigation element and the main content element that sits below it. If I make the navigation items inline blocks, the gap goes away. I really wouldn't expect this behavior as floated items are supposed to be removed from the page flow and thus wouldn't be able to push down the content div. I looked at the page in Chrome Dev Tools and didn't see anything there that would account for this gap.
Thanks.
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Header Gap Problem</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="../reset.css" />
<link rel="stylesheet" href="base.css" />
</head>
<body>
<div class="wrapper">
<nav class="nav" role="navigation">
<li class="nav-item">Members</li>
<li class="nav-item">Events</li>
</nav>
<div class="content-main">
Main content
</div>
</div>
</body>
</html>
CSS
body {
-mox-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.wrapper {
margin: 0 auto;
}
.nav {
position: relative;
display: inline-block;
width: 100%;
background: #34495e;
}
.nav-item {
float: left;
/*
display: inline-block;
*/
padding: 1em;
color: #fff;
text-decoration: none;
}
.content-main {
padding: 1em;
background: #cf6;
}