SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    margin and padding

    Hi

    Can someone clarify some terms for me please?

    margin - the space around an element
    padding - the space between the element and its content

    LEFT - the space between the left edge of an element and the left edge of the element's container

    I am having problems positioning elements and controlling their sizes and spaces around them, and I want to know if my understanding is correct or not.

    Thanks

  2. #2
    SitePoint Wizard silver trophy KLB's Avatar
    Join Date
    Nov 2003
    Location
    Maine USA
    Posts
    3,781
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Imagine that each tag is a little box. The area outside the box is margin. The area between the box and the contents of the box is padding.

    As a general practice to eliminate cross browser issues, when either padding or margin is defined for a tag, both should be defined.
    Ken Barbalace: EnvironmentalChemistry.com (Blog, Careers)
    InternetSAR.org
    Volunteers Assist Search and Rescue via Internet
    My Firefox Theme: Classic Compact
    Based onFirefox's default theme but uses much less window space

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2003
    Location
    Orlando
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would further define margin as the space between one element and another but then I guess that could also apply to padding in a way. Your definitions sound like the basic jist to me. Not sure about LEFT, unless you mean specifying that specific value. But it sounds like you've got it to me.

    Edit -- KLB summed up what I was thinking perfectly...

  4. #4
    SitePoint Member
    Join Date
    Dec 2003
    Location
    Canada
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks all...I need more practice on this

  5. #5
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,366
    Mentioned
    179 Post(s)
    Tagged
    6 Thread(s)
    LEFT - the space between the left edge of an element and the left edge of the element's container
    No that's margin-left, not left.

    Theres a description here:

    http://www.w3.org/TR/CSS2/box.html

    Left, in absolute positioning is how far an element is moved to the left in respect to its parent. When used in relative positioning it is how far left it is moved in relation to where it is.

    Paul


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •