I'd like to be able to set the margin-bottom
of an element to its default value.
Consider the following example in which there are h1
elements which have their respective margin-bottom
style properties set to 0:
h1 {
border: 1px solid red;
margin-bottom: 0;
}
p {
margin: 0;
}
<h1>First Heading</h1>
<p>Paragraph</p>
<h1 id="normal-margin">Second Heading</h1>
<p>Paragraph</p>
How can I reset the margin-bottom value of #normal-margin
to its initial, default value? Obviously using initial
won't work, as the initial value of margin-bottom
is 0.
I realise in this trivial example I can simply add :not(#normal-margin)
to the style definition of h1
to fix the issue. I would however like a solution which would “undo” the margin and reset it to its initial value.
I’m thinking that I’m going to have to hard-code values into the CSS, which to me seems a bit cheap. Is that the only solution to this problem?