HTMLforall

  HTML | PHP | Forum

HTML <a> tag

Syntax

<a> - </a>

Definition and Usage

The A element defines an anchor. An anchor can be used in two ways:

  1. To create a link to another document by using the href attribute
  2. To create a bookmark inside a document, by using the name or id attribute

Note: A linked page is normally displayed in the current browser window, unless you specify another target (see optional Attributes).

Optional Attributes

Attribute Value Description
charset character_encoding Specifies the character encoding of the target URL
coords

if shape="rect" then
coords="left,top,right,bottom"

if shape="circ" then
coords="centerx,centery,radius"

if shape="poly" then
coords="x1,y1,x2,y2,..,xn,yn"

Specifies the coordinates appropriate to the shape attribute to define a region of an image for image maps
href URL The target URL of the link
hreflang language_code Specifies the base language of the target URL
name section_name Names an anchor. Use this attribute to create a bookmark in a document.

In future versions of XHTML the name attribute will be replaced by the id attribute!!

rel alternate
designates
stylesheet
start
next
prev
contents
index
glossary
copyright
chapter
section
subsection
appendix
help
bookmark
Specifies the relationship between the current document and the target URL
rev alternate
designates
stylesheet
start
next
prev
contents
index
glossary
copyright
chapter
section
subsection
appendix
help
bookmark
Specifies the relationship between the target URL and the current document
shape rect
rectangle
circ
circle
poly
polygon
Defines the type of region to be defined for mapping in the current area tag. Used with the coords attribute.
target _blank
_parent
_self
_top

Where to open the target URL.

  • _blank - the target URL will be opened in a new window
  • _self - the target URL will be opened in the same frame as it was clicked
  • _parent - the target URL will be opened in the parent frameset
  • _top - the target URL will be opened in the full body of the window
type mime_type Specifies the MIME (Multipurpose Internet Mail Extensions) type of the target URL

Standard Attributes

id, class, title, style, dir, lang, xml:lang, tabindex, accesskey

For a full description, go to Standard Attributes.

Event Attributes

onfocus, onblur, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

For a full description, go to Event Attributes.

Example

Source Output

<p>Here is a link to Asset Analysis:
<a href="http://www.asset-analysis.com">
Asset Analysis</a>
</p>

<p>
Opening Asset Analysis in a new browser window:
<a href="http://www.asset-analysis.com"
target="_blank">Asset Analysis</a>
</p>

Here is a link to Asset Analysis: Asset Analysis

Opening Asset Analysis in a new browser window: Asset Analysis 


Home

Learn HTML
HTML Tutorial

HTML Reference
HTML by function
HTML by Alphabet

HTML events
HTML attributes
HTML color names

Top-Level Elements
<!--...-->
<!DOCTYPE> 
<html>
<head>
<body>
<frameset>
Head Elements
<base>
<isindex>
<link>
<meta>
<script>
<style>
<title>
Generic Block-level Elements
<address>
<blockquote>
<center>
<del>
<div>
<h1> to <h6>
<hr>
<ins>
<isindex>
<noscript>
<p>
<pre>
Lists
<dd>
<dir>
<dl>
<dt>
<li>
<menu>
<ol>
<ul>
Tables
<caption>
<col>
<colgroup>
<table>
<tbody>
<td>
<tfoot>
<th>
<thead>
<tr>
Forms
<button>
<fieldset>
<form>
<input>
<label>
<legend>
<option>
<optgroup>
<select>
<textarea>
Special Inline Elements
<a>
<applet>
<area>
<basefont>
<bdo>
<br>
<font>
<iframe>
<img>
<map>
<object>
<param>
<q>
<script>
<span>
<sub>
<sup>
Phrase Elements
<abbr>
<acronym>
<cite>
<code>
<del>
<dfn>
<em>
<ins>
<kbd>
<samp>
<strong>
<var>
Font Style Elements
<b>
<big>
<i>
<s>
<small>
<strike>
<tt>
<u>
Frames
<frame>
<frameset>
<noframes>

 

Copyright 2005-8 Sunilcare.  All Rights Reserved.
Comments or suggestions? Contact us.About us