SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    May 2003
    Location
    virginia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    CSS reset - how to get back sensible defaults?

    Hi,

    I've been using the YUI reset, and have tried my own:
    *{
    margin:0;
    padding:0;
    }

    etc., and I understand the value of being able to reset everything and have more control across browsers, but the thing I have trouble with everytime is how to get back the defaults that actually work. Does anyone know of a set of styles that get back the defaults (ul, input etc.) so I don't have to re-create those every time? Like an un-reset style sheet?

    Thanks,
    Matt

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I don't think it would be very useful or even possible (or at the very least simple) anyway because browsers all have different default styles.

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

    You are better off not using the global reset and using a reset sheet such as Eric Meyers which doesn't alter form elements as you cannot reinstate the properties on some form elements once you remove them. See my article on this point which explains what happens to form elements.

    For ul's you can reset margin and padding to zero then just add about 16px left margin when you want room for the bullets to show.

    For paragraphs and heading just set a default bottom margin.

    e.g.
    p,h1,h2,h3,h4,h5,h6{margin:0 0 .5em 0}

  4. #4
    .* draziW tnioPetiS *. bronze trophy
    Join Date
    Jun 2004
    Location
    "Then I figure the most good good guy will win."
    Posts
    1,666
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    On top of what others have already stated, I think what you are looking for is a "base" stylesheet.

    I personally use a variation of the YUI resets, then YUI fonts, then apply my base styles, layout styles, and so on...

    I would be curious to see other folks base style sheets.

    The YUI resets are nice, because it does not totally slaughter form elements... This thread might help explain better (navigate through the messages at bottom)... Which refers to this:

    Quote Originally Posted by Faruk Ateş
    Starting with CSS: revisited

    The other thing is the use of the "star-selector," or * { } in CSS.
    The star selector selects every single element, which produces an
    overkill of style-nullifying. Sander pointed out that Mozilla (for
    one) has a great deal of default styling on form controls, which the
    star selector nullifies when applying margin:0 and padding:0 to it. As
    a result, buttons don't behave like buttons anymore, and so forth. I
    never really noticed that, which only goes to show that I'm no longer
    used to buttons behaving like buttons. I did some research in this,
    and as it turned out, most of all the weblogs I frequently comment on
    have this same problem: buttons not behaving like buttons. In most
    cases, it was indeed the star selector being the culprit.

    Additionally, Mozilla developers have stated that the star selector
    slows down things. While this is apparently not noticeable for
    end-users in most cases, it may slow down other aspects that interact
    with the CSS as well. And don't forget that it's definitely a bit
    overkill to loop through all elements when you only have to alter a
    dozen of them, roughly.
    The article Paul posted looks very informative too... I am reading now. Thanks Paul!

    Cheers,
    Micky

  5. #5
    .* draziW tnioPetiS *. bronze trophy
    Join Date
    Jun 2004
    Location
    "Then I figure the most good good guy will win."
    Posts
    1,666
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mhulse View Post
    I would be curious to see other folks base style sheets.
    Just for completenesses sake, here is a good example of a base style sheet.

    I do not remember seeing that in the YUI library a year ago... Thanks Yahoo!


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
  •