tags:

views:

32

answers:

2

Should we always use Padding in place of margin wherever is possible to avoid situations of "Double Margin" bug?

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
then how we can deal with double margin bug without using hacks or extra css
metal-gear-solid
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
+1  A: 

No. Setting display: inline; is a simple workaround that doesn't affect other browsers.

RoToRa
will we have to add display:inline to every floated element or some particular
metal-gear-solid
Yes. Either manually or using some sort of scripting to do it automatically.
RoToRa
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
@Scott - so adding `display:inline` will not create any problem in other browsers. and will it always solve "margin bug"
metal-gear-solid
@RoToRa - ok then in MY CSS i will find and replace `float:left` to `float:left;display:inline` :)
metal-gear-solid
@Metal-gear-solid - correct.
Scott