Make Div Ignore Parent Div Which Has Margin Set To 0 Auto
How can I ignore the style of the parent div margin: 0 auto; I want to ignore this style for a div without nesting it outside of its parent. Is this possible in CSS?
Solution 1:
Just set the child's margins. That will override the parent's css. CSS works in a hierarchical fashion where the most specific CSS is used ("closest" to the element for lack of a better term).
Solution 2:
Yes, only set a value for the div, example
.parent { margin: 0 auto; }
.other-Div { margin: 0; }
Post a Comment for "Make Div Ignore Parent Div Which Has Margin Set To 0 Auto"