HTML5 How To Skip Navigation When Name Attribute Is Obsolete

前端 未结 1 463
轻奢々
轻奢々 2020-12-28 15:29

In the Web Content Accessibility Guidelines is states that you should supply a \"skip\" link that jumps you (for example) over a navigation block and straight into the conte

相关标签:
1条回答
  • 2020-12-28 15:48

    Instead of using <a> tags, you can use any element with the id attribute:

    <h2 id="content">Content</h2>
    
    <a href="#content">Skip to content</a>
    

    EDIT, found you a source (albeit it's Wikipedia ;-)):

    Alternatively (and sometimes concurrently), with the name or id attributes set, the element becomes a target. A Uniform Resource Locator can link to this target via a fragment identifier. Any element can now be made into an anchor by using the id attribute,[2] so using <a name="foo"> is not necessary.

    http://en.wikipedia.org/wiki/HTML_element#Anchor

    0 讨论(0)
提交回复
热议问题