View Full Version : Vertical margin on a nav object has no effect

11-08-2012, 12:25 AM
My html:

<!DOCTYPE html>

<link href="css/layout.css" type="text/css" rel="stylesheet" />

<title>Robert McBlain Solutions</title>



<div class="pagewrapper">

<a id="title"><img src= "Images/Logo.png"/></a>
<ul = "navlist">
<li class="leftmost"><a href="" class="current">Home</a></li>
<li><a href="Services.html">About</a></li>
<li><a href="About.html">Services</a></li>
<li><a href="">Experience</a></li>
<li><a href="Contact.html">Testimonials</a></li>
<li><a href="#">Contact</a></li>





margin: 0px;
padding: 0px;
body {
background-color: #AAAAAA;

width: 960px;
margin: 10px auto 0px auto;
display: inline;
width: 100%;
background-color: #FFFFFF;
width: auto;
height: 300px;
margin: 30px auto 0px auto;
font-family: Georgia, Times, serif;
border-bottom: 1px solid grey;
nav ul{
margin:0px auto 0px auto;
padding:3px 0px 3px 0px;
text-align: center;
nav li{
display: inline;
font-size: 14pt;
padding: 0px 40px;
border-right: 1px solid gray;
nav li.leftmost{
border-left: 1px solid gray;

Basically the line that says 'margin: 30px auto 0px auto;' in the nav rule, doesn't seem to work, no space appears between the image above, and if I remove the top margin from the nav and set the bottom margin of the image all that happens is the ul moves vertically within the nav object, the nav itself doesn't move and therefore doesn't create the space I want, ideas?

Many thanks

11-08-2012, 12:42 AM
Hello harvs899,
If your img is 100% width, there is no need to float it. It's already an inline element so that's not needed either.

Change that and <nav> moves with it's top margin. A background color in the right place may help too, or maybe not.

Try these changes highlighted in red -
.pagewrapper {
width: 960px;
margin: 10px auto 0px auto;
background: #f3f3f3;
} /*-----------HEADER----------*/
#title {
display: inline;
float: right;
width: 100%;
background-color: #FFFFFF;