Joel 0

Why does the navigation have a margin?

  • it didnt work. i added: #nav ul{ margin:0px; } Check my code please Joel about 10 years ago
  • i just saw that it's okay in IE, but the margin problem is in Firefox Joel about 10 years ago
  • why are the text now messed up? Joel about 10 years ago
  • there is no style rule in the #nav ul {} selector, there must be a typo in your code ;) it still has margin applied. Do you use Firebug? I think it's element and CSS inspector features would help you to spot these kinds of problems easily :) danwellman about 10 years ago

5 answers

This was chosen as the best answer


    #nav ul{
        margin: 0;
        padding: 0;
Answered about 10 years ago by Tony Crockford

Instead of just resetting your navigation's margin & padding, I recommend using a reset stylesheet. This removes the default css properties that various browsers apply to certain page elements, so to ensure your design stays continuous you should remove these and start from a level playing field in all browsers.

Try Eric Meyer's Reset Stylesheet

Answered about 10 years ago by Russell Bishop
  • the downside to a reset style sheet for novices is that they need to add new defaults for all elements. I generally use a reduced reset.css, as content list styling is something often overlooked. Tony Crockford about 10 years ago
danwellman 5600

The <ul> has a margin which is applied by browsers by default (as it's a block-level element). Set it to margin:0 to remove it

Answered about 10 years ago by danwellman
Emily G 620

Do you mean on the left? <ul> has a default padding. Set padding:0 to remove it.

Or do you mean the margin on the top? Float your div nav left to move it up to the top.

#nav {float:left;}

Answered about 10 years ago by Emily G

Remember when resetting styling for lists it is necessary to control both margin and padding. This is because some browsers use margin to indent lists and others use padding. (Both are legitimate and there is no reason to unify, which would break some legacy sites if they did).

Answered about 10 years ago by Richard Grevers