Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS CSS formatting preference

  • This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #40283
    Anonymous
    Inactive

    Just curious to see which of these is preferred and why.

    margin: 0 0 20px 0;

    or

    margin-bottom: 20px;

    I tend to use the upper method in case I ever want to quickly make changes.

    #111808
    Paulie_D
    Member

    If I just want bottom margin, I’ll use the second option.

    I don’t see any need to tell the browser NOT to do something it wasn’t going to do anyway…but I’m not going to be a css-nazi about it.

    #111809

    I generally use the longhand property. Shorthand can unknowingly override other styles.

    #111810

    i use the first format, be specific as i can .

    #111811
    Anonymous
    Inactive

    Yeah, I like the idea of not telling the browser what not to do also, but sometimes the browser defaults screw with things, so adding the zero margins make it specific. I guess then, if you use normalize or a reset, you’re telling the browser a whole lot of what not to do!

    Thanks for the feedback as usual.

    #111814
    Senff
    Participant

    Depends so much on the issue. Normally, use the longer version. However, when overriding another (general) style, the short version is preferred.

    #111816
    Kitty Giraudel
    Participant

    When there is only one direction out of 4 concerned, I use the long hand version. But for maintainability, the short hand may be easier.

    #111820
    GMB
    Participant

    The top one if I’m specifying more than one margin, otherwise the bottom one.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘CSS’ is closed to new topics and replies.