views:

96

answers:

4

If you take this example, <a name="xxx"></a> ... is this ok when creating an anchor? I have always preferred to use an already created tag for my destinations.

+2  A: 

For navigational purposes within one page, it's perfectly fine. Though that style of navigation is usually related to some kind of headings or titles, so usually most people end up surrounding the appropriate heading/title with the anchor. I guess it's better from a readability and maintenance point of view.

Wim Hollebrandse
+1  A: 

Of course, why not? You just create internal link to content block with this method.

Sergei
I like minimalistic and clean markup and poluting my markup with alot of empty anchor tags is kinda not my melody. I'm trying to find something about this in the w3c spec but I just find this http://www.w3.org/TR/WCAG20-TECHS/H30
Marcus
+8  A: 

If you are using this for in page navigation you can just just the id of the element rather than having to set up the anchor tag e.g.

<a href="#stuff">link to stuff</a>

<div id="stuff"></div>

I personally would not use an empty anchor tag.

matpol
Do you know if I can find something about this in the w3c specs?
Marcus
http://www.w3.org/TR/html401/struct/links.html
matpol
A: 

Using an anchor tag without href is useless. It is simply put a text styling to the contents inside the tag. But you can use a anchor tag without a href, But onthe onclcick event you can dynamically divert the navigation of page. We use simply in some sites to apply the style to the contents within the anchor tag.

TbmBizz