Name Attribute Obsolete in HTML 5

Udemy - 30 Amazing Days of HTML and CSS Learning
30 Amazing Days of HTML and CSS Learning
Learn HTML & CSS and start creating your own websites within 30 days

With HTML 4, you can create a name anchor on a web page using HTML code in the form shown below:

<a name="some_name">Some Text</a>

For instance if I had a long webpage, mypage.html, and I wanted to be able to use a link that pointed not to the top of the page but to a specific location in the page, I would use the name attribute to create an "anchor" on the page with HTML 4. E.g., suppose I broke the page into sections and I wanted to create a link to section 3; I could use code such as that shown below:

<a name="section3">Section 3</a>

In the above example, section3 is the name of the anchor. I could put a link in another webpage pointing to section 3 on the above page using the following HTML code:

<a href="">

However with HTML5, use of name anchors on a web page has been deprecated. E.g., if you check your HTML code for adherence to the HTML 5 standard with the Nu Html Checker provided by the World Wide Web Consortium, you will see a warning similar to the following one displayed if you use the name attribute to specify the name of an anchor on a page.

The name attribute is obsolete. Consider putting an id attribute on the nearest container instead.
From line 245, column 5; to line 245, column 26
iv>↩↩ <h3><a name="creating_db">Creati

You can achieve the same effect, but make your HTML code HTML 5 compliant by using a unique id for an element using id. E.g.:

<h3 id="creating_db">Creating Dtabases and Tables</h3>

Or you can even simply substitute "id=" where "name=" appeared:

<h3><id="creating_db">Creating Databases and Tables</a></h3>

E.g., I could use to jump to the spot on the page where I inserted the id="creating_db", or, if I put references at the end of a webpage, I could use the following for a reference:

<a href="" id="ref1"> Datatypes In SQLite Version 3</a><br>

I could then link to it from within the page itself using the following HTML code:

affinity<sup><small><a href="#ref1">1</a></small></sup>



TechRabbit ad 300x250

Justdeals Daily Electronics Deals1x1 px