
The Anchor Tag and the Href Attribute
HTML uses the <a> (anchor) tag to create a link to
another document. An
anchor can point to any resource on the Web: an HTML page,
an image, a sound file, a movie, etc.
The syntax of creating an anchor:
|
<a href="url">Text
to be displayed</a>
|
The <a> tag is used to create an anchor to link from,
the href attribute is used to address the document to link
to, and the words between the open and close of the anchor
tag will be displayed as a hyperlink.
This anchor defines a link to Hostedware:
|
<a href="http://www.hostedware.com/">Click
here to visit Hostedware's home page</a>
|
The line above will look like this in a browser:
Click here
to visit Hostedware's home page
The Target Attribute
With the target attribute, you can define where the linked
document will be opened.
The line below will open the document in a new browser window:
|
<a href=http://www.w3schools.com/
target="_blank">Visit Hostedware!</a>
|
<
Back to HTML Basics
|