SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2006
    Posts
    139
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question on padding top right bottom left

    I am follow in a book and it said use on a sidebar: padding: 0.75em 0;

    Anyway I alway thought when using padding or margins it affects the top, right, bottom and left in that order. So by using - padding: 0.75em 0;
    it should only affect the top and right? But in sidebar had the 0.75em padding affecting the top and bottom (which was supposed to happen in the book) just trying to understand why it didn't just affect the top padding?

  2. #2
    SitePoint Addict joaquin_win's Avatar
    Join Date
    Jul 2005
    Location
    Venezuela
    Posts
    224
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There you are using a shorthand form for padding (margins also has one like that).

  3. #3
    SitePoint Addict
    Join Date
    Mar 2005
    Location
    Toronto
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The issue here is the sides affected depends on the number of properties you define.
    Here is a list of how it suppose to work:
    Code:
    padding: 0; /*defines all sides with 0*/
    padding: 10px, 0; /*top and bottom 10px, left and right 0*/
    padding: 10px, 0, 100px; /*top = 10px, left and right = 0, bottom = 100px*/
    padding: 10px, 0, 100px, 2px; /*goes by the order of top, right, bottom, left */
    Hope this helps : )
    In search of the clouds...and maybe some work

  4. #4
    Non-Member Egor's Avatar
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    7,305
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Except the commas don't work.


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
  •