Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-07-2012, 11:25 PM   PM User | #1
harvs899
New Coder

 
Join Date: Oct 2012
Posts: 16
Thanks: 3
Thanked 0 Times in 0 Posts
harvs899 is an unknown quantity at this point
Vertical margin on a nav object has no effect

My html:
Code:
<!DOCTYPE html>
	<html>
		
		<head>
			<link href="css/layout.css" type="text/css" rel="stylesheet" />
            
			<title>Robert McBlain Solutions</title>
            
		</head>
		
		<body>
		
			<div class="pagewrapper">

					<a id="title"><img src= "Images/Logo.png"/></a>			
					<nav>
						<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>
						</ul>
					</nav>
				
			</div>
			
		</body>
		
	</html>
CSS:

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

.pagewrapper{
	width: 960px;
	margin: 10px auto 0px auto;
}
/*-----------HEADER----------*/
#title{
	display: inline;
	width: 100%;
	float:right;
	background-color: #FFFFFF;
}
nav{
	width: auto;
	height: 300px;
	background-color:#F3F3F3;
	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
harvs899 is offline   Reply With Quote
Old 11-07-2012, 11:42 PM   PM User | #2
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
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 -
Code:
.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 the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:57 PM.


Advertisement
Log in to turn off these ads.