HTML <a> tag
Definition and Usage
The <a> tag defines an anchor. An anchor can be used in two ways:
- To create a link
to another document by using the href attribute
- To create a bookmark inside a
document, by using the name or id attribute
Differences Between HTML and XHTML
NONE
Tips and Notes
Note: A linked page is normally displayed in the current browser
window, unless you specify another target.
Example
| Source |
Output |
|
<p>Linking to W3Schools:
<a href="http://www.w3schools.com">
W3Schools</a>
</p>
<p>
Opening W3Schools a new browser window:
<a href="http://www.w3schools.com"
target="_blank">W3Schools</a>
</p>
|
Linking to W3Schools:
W3Schools
Opening W3Schools a new browser window:
W3Schools
|
Optional Attributes
DTD indicates in which DTD the attribute is
allowed. S=Strict, T=Transitional, and F=Frameset.
| Attribute |
Value |
Description |
DTD |
| charset |
character_encoding |
Specifies the character encoding of the target URL |
STF |
| 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 |
STF |
| href |
URL |
The target URL of the link |
STF |
| hreflang |
language_code |
Specifies the base language of the target URL |
STF |
| 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!! |
STF |
| 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 |
STF |
| 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 |
STF |
| 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. |
STF |
| target |
_blank
_parent
_self
_top
|
Where to open the target URL.
- _blank - the target URL will open in a new window
- _self - the target URL will open in the same frame as it was clicked
- _parent - the target URL will open in the parent frameset
- _top - the target URL will open in the full body of the window
|
TF |
| type |
mime_type |
Specifies the MIME (Multipurpose Internet Mail Extensions) type of the target URL |
STF |
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.
Try-It-Yourself Demos
Create hyperlinks
How to create hyperlinks.
An image as a link
How to use an image as a link.
Open a link in a new browser window
How to open a link in a new browser window, so that the visitor does not have to leave your Web site.
Link to a location on the same page
How to link to a bookmark.
Break out of a frame
How to break out of a frame (if your site is locked in a frame).
Create a mailto link
How to link to a mail message (will only work if you have mail installed).
Create a mailto link 2
Another mailto link.
The Ektron Intranet
lets you do everything you need to do on your corporate intranet and everything you want to do... all with just one application.
What can you do with the Ektron Intranet? |

|
Navigate through content, documents, assets, colleagues and workgroups quickly and intuitively with enterprise search |

|
Communicate with friends and colleagues with forums, message boards and corporate blogging using the new Social Networking Platform |

|
Promote collaboration among coworkers in your organization through project workspaces where others can efficiently find information and work together |

|
Personalize your company profile by bookmarking and organizing favorite content, uploading assets, posting photos, blogging, and more |

|
Interact with features like tagging, flagging, wikis and ratings found in the Web 2.0 Toolbox |
 |
Author/edit content, manage navigation, menus, audit trails, workflow and approvals with the best in breed Content Management |
|
|
|
|
See why there are 20,000+ Ektron integrations worldwide. Request an
INSTANT DEMO or download a
FREE TRIAL today. |
|