How to write both h1 and h2 in the same line?
h1
and h2
are native display: block
elements.
Make them display: inline
so they behave like normal text.
You should also reset the default padding
and margin
that the elements have.
Keyword float
:
<h1 style="text-align:left;float:left;">Title</h1>
<h2 style="text-align:right;float:right;">Context</h2>
<hr style="clear:both;"/>
In many cases,
display:inline;
is enough.
But in some cases, you have to add following:
clear:none;