Skip to content
Fragmented Development

What's In A Name?

While re-designing a page that relied heavily on internal linking, I ran into a problem using a numeral at the beginning of the name attribute. Whenever I used a name that started with a digit, the validator returned an error. This had never happened before, so I checked the reasoning behind the error*.

Apparently the name attribute has been deprecated, and the id attribute is now used instead.

I think this is great for quite a few reasons, one being that 'id' is shorter than 'name', saving me two characters on each internal link. I know, it's not much, but eventually that will add up!

I also like this new change because it makes so much sense. All the name attribute ever really did was give an ID to an anchor, so we're really cutting the pretense and getting straight to the point.

I've yet to research how much browser support this has so far, so for now I'm using both for backwards compatibility. The name attribute is still valid, it's just deprecated, so <a name="foo" id="foo"></a> is a perfectly valid internal reference. Just watch your naming conventions!

* I use the HTML Validator extension with Firefox, which allows you to view all validation errors in real-time, as well as being able to pick out errors in your source code, and explain why they're errors.

Tags: html

Add Your Comment