In certain situations (such as outdated versions of browsers like IE, Gecko, Webkit) and when dealing with inheritance, elements that have position:relative;
applied may cause issues with using margin:0 auto;
, even if no values for top
, right
, bottom
, or left
are specified.
If you encounter this problem, changing the element to position:static;
(which is the default positioning) could resolve it in these scenarios. Typically, block-level elements that have a specific width will correctly apply margin:0 auto;
whether using relative
or static
positioning.