ncubica ncubica - 1 month ago 18
HTML Question

Why the target property in link has an underscore?

I have been coding for many years and only at this moment I just realized that the property

target
from the element
<a>
requires all their values start with an underscore (a lot of us know that), but I don't know why? I mean from the top of my head I don't remember other value which requires to start with an underscore except for that. Does anybody know what is the reason behind this implementation, and what other values start with an underscore?

This is just a historical question, but it would be cool to know why everybody uses this convention which I think is only applied to
target
.

target - (
_blank
,
_self
_parent
,
_top
)

Answer

It's not a convention; it's specified in the standard (4.0, 5) that the four reserved names for the target attribute are _blank, _self, _parent, and _top. You can have other target values, but they would be custom names which must start with a letter. Having the reserved ones start with an otherwise illegal value distinguishes them from custom named targets.

Comments