- This topic is empty.
Viewing 8 posts - 1 through 8 (of 8 total)
Viewing 8 posts - 1 through 8 (of 8 total)
- The forum ‘CSS’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
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.
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.
I generally use the longhand property. Shorthand can unknowingly override other styles.
i use the first format, be specific as i can .
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.
Depends so much on the issue. Normally, use the longer version. However, when overriding another (general) style, the short version is preferred.
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.
The top one if I’m specifying more than one margin, otherwise the bottom one.