Is it better to wrap it around the whole link or around the anchor text? <h1><a href='link.php' title='keyword'>keyword</a></h1> HTML: or <a href='link.php' title='keyword'><h1>keyword</h1></a> HTML: Or does it matter at all? also, is it same for h2, h3, strong and bold?
I have <h1> around the anchor text on some links on one of my sites. I've had it that way for more than two years, and it has never been a problem, and some of the linked pages are number 1 in Google for their main keyword. So that seems to work. But I don't know for sure if it makes any difference or not.
Good question. Hope you get some good answers. My guess is that it doesn't matter, but that's just a guess.
Heading tags are applied to inner HTML text ("keyword" in the examples above) so either way should have the same effect. I don't know if SE's care if heading tags are wrapping or wrapped by link tags but they shouldn't IMHO.
I think that it would be much wiser to put your href inside your <H1> I'm not sure what are the seo effects of doing the opposite but it will put order in your html source text, and will be easier to change later you should keep your html pages as clean as you can, and try to avoid mess doing: <a href='link.php' title='keyword'><h1>keyword</h1></a> is messy, if you do that you will just have problems finding your headers
I would recommend inserting the anchor tag INSIDE the heading tag. Reason? Well, you should create an anchor for the words, and not for the tag itself.