Visual Studio不喜欢页内锚标签:
Validation (XHTML 1.0 Transitional):
Attribute ‘name’ is considered
outdated. A newer construct is
recommended.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd" xml:lang="en"> ... <body> ... <p>On this page…</p> <ul> <li><a href="#one">Section One</a></li> ... </ul> ... <h2><a name="one">Section One</a></h2> ... </body> </html>
解决方法
您应该使用id属性.以相同的方式工作,您不需要人工< a name = ...>,而是简单
<h2 id="one">Section One</h2>