Jump to content
DannyGolden

Can't Get A Gap Between Navigation and Content Areas[Resolved]

Recommended Posts

Hi, I'm simply trying to induce a gap between my navigation area and my content area, like this website:http://www.thearteryfoundation.com/ But whenever I try adding padding or margin, my two div's seem to be attached at the hip. HTML:

[/s][s]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/s][s]<html xmlns="http://www.w3.org/1999/xhtml">[/s][s]<head>[/s][s]<title>Metalcore</title>[/s][s]<link rel="stylesheet" type="text/css" href="main.css" /> <!-- Main Paige Styling -->[/s][s]</head>[/s][s]<body>[/s][s]<div id="nav">[/s][s]  <ul>[/s][s]   <li><a href="#">Home</a></li>[/s][s]   <li><a href="#">Bands</a></li>[/s][s]   <li><a href="#">About</a></li>[/s][s]  </ul>[/s][s]</div><!-- End #Nav -->[/s][s]<div id="wrapper">[/s][s]<div id="content">[/s][s]  <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>[/s][s]</div><!-- End #Content -->[/s][s]</div><!-- End #Wrapper -->[/s][s]</body>[/s][s]</html>[/s][s]

CSS:

[/s][s]/* Begin Default Element Styling */[/s][s]html {[/s][s]background: url(images/background.png) no-repeat center center fixed;[/s][s]-webkit-background-size: cover;[/s][s]-moz-background-size: cover;[/s][s]-o-background-size: cover;[/s][s]background-size: cover;[/s][s]}[/s][s]/* End Default Element Styling */[/s] [s]/* Begin ID Styling */[/s][s]#nav {[/s][s]background-color: #000;[/s][s]float: left;[/s][s]padding: 0px;[/s][s]width: 100%;[/s][s]}[/s][s]#nav ul {[/s][s]list-style: none;[/s][s]margin: 0px auto;[/s][s]width: 960px;[/s][s]}[/s][s]#nav li {[/s][s]float: left;[/s][s]}[/s][s]#nav li a {[/s][s]color: #069;[/s][s]display: block;[/s][s]font-weight: bold;[/s][s]padding: 8px 15px;[/s][s]text-decoration: none;[/s][s]}[/s][s]#wrapper {[/s][s]background-color: rgba(245,245,245, 0.5);[/s][s]margin: 20px auto;[/s][s]padding: 10px;[/s][s]width: 960px;[/s][s]}[/s][s]/* End ID Styling */[/s][s]
Edited by DannyGolden

Share this post


Link to post
Share on other sites
#nav {	background-color: #000000;  /*  float: left; removed by dsonesuk, causes non float element/s below it to merge*/	overflow: hidden; /*added by dsonesuk, so nav can envelope floated child elements*/	padding: 0;   /* width: 100%; remove by dsonesuk, now not required with float removed*/}

Edited by dsonesuk

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...