[Web4lib] widening center content - margin property

Andrew Hankinson andrew.hankinson at gmail.com
Wed Oct 10 14:54:46 EDT 2007


Margin sets the width between block elements, whereas padding sets the
amount of spacing within the block element.  So the right margin of 200px is
from the walls of the container div.

You seem to have a width of 100% on your wrapper div, and moved your margins
to the content div.  Try taking the "wrapper" div out and float the content
div.  If you can't do that for some reason, try adding the margins
themselves to the wrapper div so that it does not take up the entire width
of the parent div.

Using Firebug on your page shows some very interesting margin selections.
 If you're not using it in Firefox, add it (it's an extension) and then
inspect the block elements.  You'll get a visual idea of how your margins
are interacting with each other.

You also might try rearranging your code so that you have your navigation
div first, your content div second and your extra div third.  That way your
floats may line up correctly.

Hope that helps!
Andrew


More information about the Web4lib mailing list