Given:
<h2>Header Line 1</h2>
<h2>Header Line 2</h2>
I know that I access the second h2 and can apply some spacing below that element by doing:
h2 + h2 {
padding-bottom: 20px;
}
However, some of my sections only contain a single header line like:
<h2>Catchy Tagline!</h2>
Can I selectively access and apply something like padding-bottom: 20px;
to the h2:first-child
when there is only one h2
element?
Otherwise, I would be adding a 20px space between any/all h2
tags and I want them to stay set at 0 margin/padding if they are stacked as my first example shows.
, say, that won't work because it's not the last child?
– armadadrive Mar 15 '16 at 16:00