|
|
|
|
|
|
Link Syntex |
<a href="url">link text</a> |
The <a> tag defines a hyperlink, which is used to link
from one page to another. |
|
<a href="http://www.w3schools.com/html/">Visit our HTML tutorial</a> |
The most important attribute of the <a> element is the
href attribute, which indicates the link's destination. |
|
Local link |
<a href="html_images.asp">HTML
Images</a> |
|
|
|
Image as Link |
<a href="default.asp"> |
|
|
<img src="smiley.gif" alt="HTML tutorial" style="width:42px;height:42px;border:0;"> |
|
|
</a> |
|
|
|
Create a Bookmark |
<h2 id="tips">Useful Tips
Section</h2> |
First, create a bookmark with the id attribute: |
|
<a href="#tips">Visit the
Useful Tips Section</a> |
Then, add a link to the bookmark ("Useful Tips
Section"), from within the same page |
|
<a href="html_tips.html#tips">Visit
the Useful Tips Section</a> |
Or, add a link to the bookmark ("Useful Tips
Section"), from another page |
|
|
The linked page appears in a new tab |
<a href="http://www.w3schools.com/" target="_blank">Visit W3Schools!</a> |
The target attribute specifies where to open the linked
document |
|
target="_blank" |
target="_blank" >
Open link in a new window or tab |
|
target="_self" |
Opens the linked document in the same frame as it was clicked
(this is default) |
|
target="_parent" |
Opens the linked document in the parent frame |
|
target="_top" |
Opens the linked document in the full body of the window |
|
framename |
Opens the linked document in a named frame |
|
|
HTML Links - Colors |
<style> |
|
|
a:link {color:green; background-color:transparent; text-decoration:none} |
|
|
a:visited {color:pink; background-color:transparent; text-decoration:none} |
|
|
a:hover {color:red; background-color:transparent; text-decoration:underline} |
|
|
a:active {color:yellow; background-color:transparent; text-decoration:underline} |
|
|
</style> |
|
|
|
|
|