Below is my HTML structure
<div class="ContentHeader">
<hgroup>
<h1>Title</h1>
<h2>Subtitle</h2>
</hgroup>
</div>
I'm looking for a solution to the issue that doesn't use javascript, I know I can do that but I'd prefer if there was a CSS only solution.
I want to only style the h1
, if the h2
also exists. So, if there is no h2
, then there is no styling applied to the h1
.
I tried this but it only styled the h2
.ContentHeader hgroup h1 + h2 {
padding-bottom: 10px;
}
Any help would be greatly appreciated.