Given the following semantic markup:
<h3> SCOPE OF WORK. </h3>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
<p>Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
I would like to display the heading inline with the paragraph, like so:
SCOPE OF WORK. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
Option 1: float the heading.
This works so long as the heading fits on one line. When it doesn't, the float forms a wide block so the paragraph starts to the right of the block, or below instead of continuing inline:
| SCOPE OF | Lorem |
| WORK | ipsum |
| sit amet, consect|
Option 2: display both elements inline.
A style rule such as: h3, h3+* {display: inline;}
might work. This assumes that they are preceded & followed by other block elements. Otherwise, other inline elements would flow into them. Also, the adjacent selector (+
) is not available in all browsers.
Option 3?
Without adding unnecessary classes or wrapper elements, and keeping it valid & semantic (no span.h3
inside the paragraph!), is there a better way to do this simple thing?