Brian's Blog

items I see across my tribes

HTML Links–The name Attribute

August 28
by briancarter 28. August 2011 10:38

The name attribute, or named anchor, is used to create a bookmark inside an HTML document.

I didn't include a discussion on HTML link attributes in my session at the .Net user group. The name attribute is the basic building block for Client-Side MVC and Single Page Applications (SPAs). Looking at the SPA examples in the attached file, you will see "...htmlNameAttribute.html#area4" the hash in the URL (called the hash key in Commonwealth English - the number sign in US, somehow the name hash has stuck in coding). The original use was to jump to sections in the document. Many SPAs override the hash to enable the dynamic loading of pages.

Give it a try. Notice that when you click the link - the browser tries to bring that section to the top of the document. This is true unless the section is towards the end of the document and can't scroll any further.

Download the sample html page: 

htmlNameAttribute.html (7.21 kb)

Categories:


 Questions or Feedback, my contact information is located on my About page.


The opinions, thoughts, and comments made in these blog posts are solely my own (unless otherwise stated). They do not reflect the opinions, thoughts or practices of my employer, my universities, my family, or anyone else. Also, I retain the right to change my mind about anything I publish here without having to go back and edit posts that occurred in the past. 

These are my opinions, or just as likely, someone else's opinions that I leveraged for my own.