Search code examples
htmlcssalignment

How to keep two different header (h2) tags on one line?


I'm trying to make it so I have a person's name and the date on one line, though the name aligned left and the date aligned right.

<h2>Firstname Surname</h2><text align="right"><h2>Date</h2>

The above seems to align them both, but puts them on separate lines. I assume this is because I'm using two different h2 tags, though if I leave them as one:

<h2>Firstname Surname <text align="right"> Date</h2>

I get all the text on one line, but with no aligning.


Solution

  • try this..

    <h2>Firstname Surname <span style="float:right;">Date</span></h2>