What you're referring to here is a source anchor; one anchor in a pair that points from one location (the source) to another (the destination). That destination can either be found in the same document, or a different one. As you've discovered, a fragment identifier (#fragment-id) designates a particular location within a document.
Originally Posted by AnGeLiC
This is the destination anchor, and there are in fact two ways to specify one. An anchor (a) element with a name attribute acts as a destination anchor, where the value of that attribute would match against the fragment identifier. This, however, is an increasingly less common approach. In its place, one can add an id attribute directly to the destination element, which adds a lot more flexibility. For example, the above could be replaced with
Put this where you want that link to jump to on the page:
To include markup, it's best to use [html]...[/html] rather than [quote]...[/quote]. The former retains formatting, which can greatly aid readability for large sections of code. There are similar tags for miscellaneous code like CSS or scripts ([code]...[/code] and PHP code ([php]...[/php].