CSS Positioning: Margin, Border, and Padding

MOVED

This content has been moved to my new blog at

https://petelepage.com/blog/2006/05/css-positioning-margin-border-and-padding/

Thanks,
PEte

Comments

  • Anonymous
    May 15, 2006
    The comment has been removed

  • Anonymous
    May 15, 2006
    This is all very nice to know but I have a problem regarding this. IE and FF renders theese boxes differently. Specifically the one with both width and padding set.
    Does anyone have any good ideas as to how you should do a cross browser version of this simple thing?
    I want to be able to have a fixed outer width and use internal padding as it works in IE.

  • Anonymous
    May 16, 2006
    I've wanted to create something like the above for my techs for a while, just had never gotten around to it, so I'm going to take advantage of this and forward it on to them. :)

    Something in CSS I always had an issue remembering was the order of setting different values for Margin, padding, etc.  Example, if I wanted to do 10 pixels on the top, 5 pixels on the right and left, and 15 pixels on the bottom, I would usually do the longer margin-top: 10px, margin-right: 5px;, margin-left: 5px; and margin-bottom: 15px;
    ...

    Until I realized it was done clockwise!  so a more concise version would be: Margin: 10px 5px 15px 5px (top, right, bottom, left), now I just visualize a clock and its simple. :)


  • Anonymous
    May 16, 2006
    The comment has been removed

  • Anonymous
    May 17, 2006
    VERY misleading article with incorrect explanations and demonstrations.

    For a start, it hasn't even got a valid doctype specified, so the browsers are rendering in Quirks mode which is why none of the examples work properly. In fact the examples demonstrate the bugs in the ancient IE6 - and render differently in WORKING browsers such as Firefox, Safari and IE7.

    This article should be pulled before it confuses any more people.

  • Anonymous
    August 01, 2008
    PingBack from http://gia.freepicturenews.info/csspositioningwithmargins.html

  • Anonymous
    August 01, 2008
    PingBack from http://laurel.freevideonewsradio.info/csspositioningwithmargins.html