Skip to content Skip to sidebar Skip to footer

What Is The Correct Alternative For The Attribute "name"?

When I validate this page with the w3c validator, I am told that 'the name attribute is obsolete,' however, I cannot find an alternative. Every article I can find about linking wit

Solution 1:

You can skip to any element with specified identifier like that:

<div id="navigation"></div>

<div id="content"></div>

<div id="footer"></div>

<a href="#navigation">Skip to navigation</a>

Solution 2:

you can use a class name or an id:

<a id="top"></a>

<a class="top"></a>

or you can assign multiple class to make it more specific

<a class="link top"></a>

or with html5 you can do this:

<a data-name="top" ></a>

Solution 3:

in the old days, speek html 4, you could to internal links like:

<a href="#bottom">link</a>

and the target would be

<a name="bottom"></a>

Now this days we do it like that:

<a href="#bottom">link</a>

target:

<foo id="bottom"></foo>

You see i use foo, because it can be whatever element you like


Post a Comment for "What Is The Correct Alternative For The Attribute "name"?"