Hey there. I noticed that sites like Wikipedia often have links that link you not only to a page, but a specific part of the page.
How do I write my anchor tags so that I can achieve that?
Also, would the links have to be on the same page that I'm having them link to, or can I put them on another page, and have them link directly to a specific part of a page?
You just add an
id attribute to the section you want to link to. For example:
<h2 id="section">Section headline</h2>
You can then link to the specific
id using the hash mark
#, in this case
http://www.example.com/pagename.html[b]#section[/b]. You can do this both internally and externally, and even as a relative link (e.g.
<a href="[b]#section[/b]">Internal link</a>).
You can add an
id attribute to all tags. In some very old browsers, you can't use the
id attribute, but will in stead have to use an anchor tag with a
<h2><a name="section"></a>Section header</h2>
I generally don't do this anymore, as very few people still use browsers which doesn't recognise the
id attribute, but you have to make that decision for yourself.