Krusifix
01-11-2006, 11:22 PM
I was looking through the CSS Div Layout section, and browsed through the code:
body { margin-top: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
#menu { position: absolute; right: 5px; padding: 0px; width: 150px;}
When we set this div layout up, we achieve a right column (I removed the content layout tab, to conserve space), but how exactly does the 5px absolute positioning work? Does this create a 5px gap from the right side for this div layer? If I had a black body background color and I set the right column's background color to white, would this right column have a 5px gap from it's right? Wouldn't it be easier to set position: center right, and then set its width?
On a side note, what is the difference between padding: #; and margin: #; within the css div selector?
body { margin-top: 0; margin-bottom: 0; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
#menu { position: absolute; right: 5px; padding: 0px; width: 150px;}
When we set this div layout up, we achieve a right column (I removed the content layout tab, to conserve space), but how exactly does the 5px absolute positioning work? Does this create a 5px gap from the right side for this div layer? If I had a black body background color and I set the right column's background color to white, would this right column have a 5px gap from it's right? Wouldn't it be easier to set position: center right, and then set its width?
On a side note, what is the difference between padding: #; and margin: #; within the css div selector?