我有几个<a name="something"></a>
我的 html 页面中的条目以启用页面 anchor ; Visual Studio 2010(带有 HTML 4.01 或 HTML 5 目标)下划线 name
属性并显示警告“元素‘名称’已过时或非标准”。
我做错了什么吗?页内锚定是否已弃用?
最佳答案
页面 anchor 现在应该使用 ID
属性完成。
这是已经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.
name
属性实际上是有效的 HTML 4.01,所以我不确定 Visual Studio 在那里做了什么(可能没有应用正确的验证)。
关于html - 页面 anchor 未通过 Visual Studio 2010 HTML 验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7533856/