Thursday, October 7, 2010

# in html!

All the C programmers tend to think of #include as soon as they see '#' symbol. But not all the people know that there is # used in html also!
Well we all have seen the wiikipedia page on one or the other thing,right? Now, there is a table of contents in every page. The elements of this table point to links in the same page. This is where a # symbol comes in handy. It is basically used to maintain an index within the web-page.
while giving the address give href="#link" instead of the entire address of the page.

and to give the target location give name="link" as a part of the 'a' attribute of the location


Here the difference from a normal href is that here we are starting the URL with # indicating that the target is in the same page. Also we have given an attribute 'name' with value=link. This is the address of the target.
(How else would the browser know where to point next?)

Hope you will find it helpfull.


No comments:

Post a Comment