I was trying to get my div that contains floating elements, to enlarge to encompass them, but it doesn't seem to pay attention to the padding of the elements, effectively chopping them off. How can I get the div to be the correct height for my list items?
html:
<html>
<head>
<link type="text/css" rel="stylesheet" href="/stylesheets/test.css" />
</head>
<body>
<div class="nav">
<ul class="nav">
<li class="nav"><a class="nav" href="#">One1</a></li>
<li class="nav"><a class="nav" href="#">Two</a></li>
<li class="nav"><a class="nav" href="#">Three</a></li>
<li class="nav"><a class="nav" href="#">Four</a></li>
</ul>
</div>
<div class="after"><h2>Heading</h2></div>
</body>
</html>
css:
ul.nav, ul li.nav {
display: inline;
margin: 0px;
padding: 0px;
}
ul.nav {
list-style-type: none;
}
li.nav {
display: block;
float: left;
background-color: red;
}
a.nav {
background-color: green;
padding: 10px;
margin: 0;
}
a:hover.nav {
background-color: gray;
}
div.nav {
background-color: blue;
overflow: hidden;
width: 100%;
}
div.after {
clear: left;
}