Should we always use Padding in place of margin wherever is possible to avoid situations of "Double Margin" bug?
views:
32answers:
2
A:
Depends on the design. There are many contexts where using padding instead of margins doesn't make sense.
If you're having trouble with a browser bug then by all means try using padding instead of margin, but it's throwing the baby out with the bathwater to say "I will never use padding ever again!"
hollsk
2010-07-20 14:46:54
then how we can deal with double margin bug without using hacks or extra css
metal-gear-solid
2010-07-20 14:50:52
You're not always going to get the double margin bug, so it's not relevant to every situation. If you *do* have the double margin bug then like I said, by all means try using padding to resolve it. If you don't have the double margin bug then there's no need to worry about whether you're using margins or not.
hollsk
2010-07-20 14:53:22
+1
A:
No. Setting display: inline;
is a simple workaround that doesn't affect other browsers.
RoToRa
2010-07-20 14:53:56
will we have to add display:inline to every floated element or some particular
metal-gear-solid
2010-07-20 14:57:03
Yes. Either manually or using some sort of scripting to do it automatically.
RoToRa
2010-07-20 15:03:43
I always add `display:inline` to every floated element because all browsers ignore it except for the one's that have the double-margin bug, so it solves the bug without any adverse affects.
Scott
2010-07-20 15:05:37
@Scott - so adding `display:inline` will not create any problem in other browsers. and will it always solve "margin bug"
metal-gear-solid
2010-07-20 15:07:11
@RoToRa - ok then in MY CSS i will find and replace `float:left` to `float:left;display:inline` :)
metal-gear-solid
2010-07-20 15:10:37