开发者

Page anchors fail Visual Studio 2010 HTML validation

开发者 https://www.devze.com 2023-04-06 21:11 出处:网络
I have a few <a name=\"something\"></a> entries in my html page to enable page anchors; Visual Studio 2010 (with either HTML 4.01 or HTML 5 target) und开发者_JAVA百科erlines name attribute

I have a few <a name="something"></a> entries in my html page to enable page anchors; Visual Studio 2010 (with either HTML 4.01 or HTML 5 target) und开发者_JAVA百科erlines name attribute and shows warning "Element 'name' is obsolete or nonstandard".

Am I doing anything wrong? Is in-page anchoring deprecated?


Page anchors should now be done with ID attributes.

This is something that has been obsoleted in the draft for HTML 5:

Authors should not specify the name attribute on a elements. If the attribute is present, its value must not be the empty string and must neither be equal to the value of any of the IDs in the element's home subtree other than the element's own ID, if any, nor be equal to the value of any of the other name attributes on a elements in the element's home subtree. If this attribute is present and the element has an ID, then the attribute's value must be equal to the element's ID. In earlier versions of the language, this attribute was intended as a way to specify possible targets for fragment identifiers in URLs. The id attribute should be used instead.

The name attribute is actually valid HTML 4.01, so I am not sure what Visual Studio is doing there (possibly not applying the correct validation).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号