Consider the text you want to use as a caption to be like a flowing sentence with two distinct phrases, not headings.
To properly structure your catch-phrase, enclose it within a <p>
element rather than a heading element.
When separating the two phrases, avoid using plain <br>
tags as they should only be used when a line break is an integral part of the content. Utilize <br>
with the aria-hidden="true"
attribute for layout purposes only.
An alternative method to separate the phrases would be to utilize generic elements for line breaks while enclosing the entire text within a <p>
element.
Using generic elements ensures simplicity, compliance with specifications, and semantically correct coding for accessibility purposes.
For example, consider wrapping each line of text in <span>
elements with appropriate classes:
.line {display: block}
<p>
<span class="line">We make it simple</span>
<span class="line">to write software.</span>
</p>