SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Some Questions

  1. #1
    SitePoint Addict
    Join Date
    May 2007
    Posts
    242
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Some Questions

    Hello. I have some questions about CSS .

    1- Why specifying a margin-top and margin-bottom declarations for anchor links doesnt work?

    2- Which sides below declarations refer to?
    PHP Code:
    padding:5px 10px;


    padding:5px 7px 21px

    Thanks in advance.

  2. #2
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1 - <a> is an inline element and therefore width, height and margin values cannot be applied to it. If you use display: block; or float the element then you can apply these values.

    2 - Padding is applied in the following order. Top, right, bottom, left.

    If two or three values are applied then the remaining sides are taken from the value opposite.

    So in your example

    Example 1) top = 5, right = 10, bottom = 5, left = 10
    Example 2) top = 5, right = 7, bottom = 21, left = 7

    Hope that helps.

  3. #3
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,109
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    2 - Padding is applied in the following order. Top, right, bottom, left.
    I was taught it was like following a clock starting at 12'o clock, it seemed to help me remember when I was starting out.

  4. #4
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by markbrown4 View Post
    I was taught it was like following a clock starting at 12'o clock, it seemed to help me remember when I was starting out.
    Yep me too, start from the top and work clockwise.

  5. #5
    SitePoint Addict
    Join Date
    May 2007
    Posts
    242
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by csswiz View Post
    Yep me too, start from the top and work clockwise.
    Thank you very much. Everything clear for me now.

  6. #6
    SitePoint Wizard
    Join Date
    Jul 2003
    Location
    Kent
    Posts
    1,921
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by csswiz View Post

    2 - Padding is applied in the following order. Top, right, bottom, left.
    I remember it as TRouBLe - TRBL - Top Right Bottom Left

    And if possible I avoid using three values, as a mental slip is a lot more trouble than it's worth.
    One value, two values or four values.


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
  •