Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Oct 2012
    Thanked 0 Times in 0 Posts

    Vertical margin on a nav object has no effect

    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

  2. #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Thanked 1,874 Times in 1,858 Posts
    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;
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use a DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts