SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Oct 2006
    Posts
    216
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    noob: * {margin:0;padding:0} ?

    Can you tell what this does?

    * {margin:0;padding:0}

  2. #2
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    39,789
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Hi,

    The asterisk is the universal selector and basically stands for any element in that position. So in the context it is in above it refers to all elements (including html and body plus everything else). Therefore it follows that all elements will have their margin and padding reset to zero.

    This will have drawbacks for some form elements because input buttons in mozilla browsers will lose their depress effect when clicked (bad for accessibility). This effect cannot be re-instated once removed and there are a couple of other issues with padding on different form elements also.

    This article explains it in detail.

    These days people are using slighltly more involved reset css instead.

  3. #3
    Object Not Found junjun's Avatar
    Join Date
    Mar 2002
    Location
    northern MI
    Posts
    1,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This recent thread might provide some insight as well:
    http://www.sitepoint.com/forums/showthread.php?t=504520


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
  •