SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Proper units for padding?

    For the { padding: x } what is the proper unit? I've seen some places using cm (centimetres) but what should it be? Or is there not a unit?

    I just want to have some good CSS down .

  2. #2
    SitePoint Addict
    Join Date
    May 2003
    Location
    Auckland
    Posts
    309
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i always use pixels

    Code:
    { padding : 5px; }
    heres a couple of padding examples - http://www.w3schools.com/css/pr_padding.asp

  3. #3
    SitePoint Addict
    Join Date
    Sep 2003
    Location
    Europe
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Depending on the design (pixel-perfect or fluid) you should use px, em or %.

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    You can use pixels, percentages, ems, exs, inches, centimeters, etc. etc. the list goes on. It doesn't really matter what unit you use, but I try to stay consistent within the same stylesheet. For example, if my width is set in pixels, I'll set the padding in pixels as well.

  5. #5
    SitePoint Evangelist N9ne's Avatar
    Join Date
    Aug 2002
    Location
    UK
    Posts
    596
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I'm using pixels for the div width so I guess pixels it is. .

  6. #6
    Pointiest Petitions carrotflowers's Avatar
    Join Date
    Jul 2003
    Location
    Suburbs of DC (MD)
    Posts
    595
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vgarcia
    It doesn't really matter what unit you use, but I try to stay consistent within the same stylesheet.
    I know this is a little off topic, but I just wanted to ask if you do this for your own peace of mind, or is there an advantage to this consistency? I try to use relative units like % or em. Would it be better to just stick to one?

  7. #7
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by furryyuri
    I know this is a little off topic, but I just wanted to ask if you do this for your own peace of mind, or is there an advantage to this consistency? I try to use relative units like % or em. Would it be better to just stick to one?
    It's just easier to figure out mathematically. 70% + 20% is easier to calculate than 70% + 10px.

  8. #8
    Pointiest Petitions carrotflowers's Avatar
    Join Date
    Jul 2003
    Location
    Suburbs of DC (MD)
    Posts
    595
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ahhh... thanks, that was fast!

  9. #9
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by furryyuri
    Ahhh... thanks, that was fast!
    I work quick

  10. #10
    Pointiest Petitions carrotflowers's Avatar
    Join Date
    Jul 2003
    Location
    Suburbs of DC (MD)
    Posts
    595
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


    So where's the answer to my other thread? Don't you have a mac laptop?


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
  •