Anchors 101: Well nobody told me!

I received a pleasant shock last night... Previously, to use # style anchors within a page, I've been adding empty <a name="foo"></a> elements. However, last night I noticed in an ALA example that this isn't necessary.

Rather than adding (useless) <a> elements, the # in the URI works (in Firefox and IE6 at least) on the id attribute of arbitrary elements. Awesome! Now, I can give my <p> or <div> elements an id and be done with it - anchors all round.

Of course, the irony is that the # token in CSS actually means "id attribute" - now that I have seen this in action, I can't believe I didn't put 2 and 2 together sooner!

Just a shame someone didn't tell me sooner!