Reputation: 4715
What would be the proper way to do this? I have an <h1>
tag, and I want to display a <a>
that is inline with it.
Upvotes: 1
Views: 2207
Reputation: 1979
Or you could use a tag:
<h1>Important title <span style="float:right"><a href="#">Link</a></span></h1>
Upvotes: 0
Reputation: 12619
By default the h1 tag has a display:block; Thus changing it to display:inline you will lose the normal feel of an h1. But your link will directly follow it.
Also why not just place the link within the h1 tag? ie:
<h1>Hello <a href="http://www.example.com"> World</a></h1>
Upvotes: 1
Reputation: 11859
Also, margin-top: - height-of-h1
on a
could do the trick - you have like 1000 options (almost literally), we can't tell you more until we see some sample code.
Upvotes: 0
Reputation: 13489
Or you could float it to the left (or right):
float: left;
However, this can cause other problems sometimes.
Upvotes: 0
Reputation: 449823
display: inline
should do the trick. It will make the <h1>
behave like any inline element.
Upvotes: 6