<a> Anchor Tag
All versions of HTML and XHTML use anchor tags. All browsers support anchor tags.
The <a>, or anchor tag, is the most important tag in HTML. This tag allows links to work. When text is surrounded by an anchor tag it becomes a link so that when it is clicked, the user is taken to a different page. It does this using the href, or hypertext reference, attribute.
An anchor tag can surround text, an image and line breaks. Be careful about any other tags or style sheets as these can cause unforeseen issues. Anchor tags cannot be nested. The closing tag is required.
Valid attributes include:
- href - this attribute makes the portion between the open and close tag into a link
- target - causes the link to open in a window of the target name. Some special names have special meaning
- _blank - causes the link to open in a new window with no name
- _parent - causes the link to open in the parent frameset. ie the frame that the current frame is in.
- _self - causes the link to open in the current frame or window.
- _top - causes the link to open in the current window, over the top of all the frames.
- name - anything other than the special names above will open the link in the frame or window with the given name. If no frame exists, a new window will be created with that name.
- name - The name attribute gives the tag a name. It can then be called using a URL and the page is user is brought to that spot on the page. This is useful for a table of contents.
Example
<a href="http://w3c.org" target="_blank">Visit the World Wide Web Consortium</a>
<a href="#thetop" name="here">Name this spot "here" and link to the top, where there is a spot named "thetop".</a>
- Add new comment
- 213 reads
by email 

