CSS Magic
I haven’t been keeping up on my css learning but I saw a new one the other day that is so applicable to text design. One can only hope that ebook reading systems will eventually support it. From https://www.youtube.com/watch?v=OGJvhpoE8b4
Often you want a different spacing between a H1 and H2 than you want between an H1 and paragraph. This is actually quite hard to do:
Title
Subtitle
This is the paragraph.
Title
This is the paragraph.
Using the :has selector you can say if the h1 class has (not) a subtitle them change the space after:
<h1 class="article-title">Title</h1>
<h2 class="article-title">subtitle</h2>
<p>Lorem ipsum baby.</p>
<h1 class="article-title">Title&</h1>
<p>Lorem ipsum baby.</p>
.article-title{
margin:0;
.article-subtitle{
margin:0;
margin-block-end: 3rem;
}
.article-title:not(:has(+ .article-subtitle)){
margin-block-end: 3rem;
}