When I try to set margin-top
to the #nav
element, why does that property than affects the whole header div?
heres the source:
<!DOCTYPE html>
<html>
<head>
<title>Improving Great Deal</title>
<style type="text/css">
* {
margin: 0px;
padding: 0px;
}
#header {
background: black;
height: 60px;
width: 100%;
clear: left;
}
#nav {
width: 50%;
height: 40px;
background: red;
margin: 5px auto;
}
#nav ul {
list-style: none;
}
#nav ul li {
float: left;
}
#nav ul li a {
text-decoration: none;
color: white;
font-size: 20px;
padding: 0px 23px;
line-height: 34px;
}
</style>
</head>
<body>
<div id="header">
<div id="nav">
<ul>
<li><a href="#">Pocetna</a></li>
<li><a href="#">Forum</a></li>
<li><a href="#">Blog</a></li>
<li><a href="#">Pitanja</a></li>
<li><a href="#">Informacije</a></li>
<li><a href="#">Zarada</a></li>
</ul>
</div>
</div>
</body>
</html>