/    Sign up×
Community /Pin to ProfileBookmark

Surrounding Anchor Text with <h2> Tags

Hi All,

I’m trying to set up a hyperlink where [I]only[/I] my anchor text is surrounded by <h2> tags, as follows:

[B]<a href=”http://www.%DOMAINNAME.EXT%/”><h2>%HYPERLINKTEXT%</h2></a>[/B]

This format, however, doesn’t validate with W3C:

[B]Error Line 142 column 42: document type does not allow element “H2” here; missing one of “APPLET”, “OBJECT”, “MAP”, “IFRAME”, “BUTTON” start-tag.[/B]

Is there anything I can do to make this work, aside from moving the <h2> tags outside of the <a> tags?

Thanks in advance for any input provided. ?

Sam

to post a comment
HTML

4 Comments(s)

Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYDec 06.2005 — aside from moving the <h2> tags outside of the <a> tags?[/QUOTE]
why not?

that's how you would do it, <a> doesn't allow an <h2> here
<i>
</i>&lt;h2&gt;&lt;a href="http://www.domain.com"&gt;Visit domain.com&lt;/a&gt;&lt;/h2&gt;
Copy linkTweet thisAlerts:
@WebFreedomauthorDec 06.2005 — For SEO purposes, it would be ideal to have just the anchor text within the <h2> tags. But if I have no other options, I'll move 'em outside the <a> tags.

Thanks,

Sam
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYDec 06.2005 — why would that change anything for SEO?
Copy linkTweet thisAlerts:
@WebFreedomauthorDec 06.2005 — Well, I'm not an SEO expert by any means, but based on what I've read, the fewer and more targeted (i.e. keywords) your <h1> and <h2> texts are, the better your SEO will be. But maybe the SE spiders will ignore the actual link and only take the anchor text into account. Is that what you're thinking?
×

Success!

Help @WebFreedom spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...