Develop PHP Website for Learning Web Design Free Online
  Home   |   Forums   |   DevCMS
  Join   |   Log In
 
   

HTML Tutorials - Learn HTML

Tutor at Develop PHP
Creating Links using the HTML anchor tag
By: Adam      Created: Jul 13, 2008      Views: 4190 Tweet This Page  Post page to Facebook  Post page to Facebook

Link to pages that live in the same directory (folder) with your "index.html" file

(assuming that you have created a file named contact_us.html and
 have placed it in the same folder as the main file with the link on it)

Example: Contact Us

Code: <a href="contact_us.html">Contact Us</a>


Link to pages that live in a separate folder inside of your main project folder

Example: Contact Us

Code: <a href="folder_name/contact_us.html">Contact Us</a>


Link to pages that live in a folder one level up from your current folder

Example: Link to file in parent folder

Code: <a href="../parent_folder/anyfile.html">Link to file in parent folder</a>


Link to another website

Example: www.developphp.com

Code: <a href="http://www.developphp.com/">www.developphp.com</a>


Image Links    ( you can link to the image itself, a web page, or a website )

Example: Image Link < click it
Code: <a href="my_pic.jpg"><img src="my_pic.jpg" alt="Image Link" /></a>


Custom Image Link

Example:   Cool 
Button < click it

Code: <a href="contact_us.html"><img src="cool_button.jpg" alt="Cool Button" width="124" height="36" border="0" /></a>


Mail To Link (email link)

Example : developer@developphp.com

Code: <a href="mailto:developer@developphp.com">
developer@developphp.com
</a>

Mail To Link with pre-filled content

Example : Join Mailing List

Code: <a href="mailto:developer@developphp.com?subject=Add me to your mailing list&body=Hello, please add me to your list.">
Join Mailing List
</a>


Named Anchor

Let's say you have a long scrolling web page with different sections to read and you would like to be able to get a reader to an exact point in the web page.

First set your anchor point inside the document at the point you want to jump to:

Code: <a name="doc_point_1"></a>

Then set up the link to it from the same or a different web page:

Code: <a href="index.html#doc_point_1">Go to my Point 1</a>

Example: Go to the start of the text on this page


The Link "Target" Attribute

Now that we know most of the ways to create a link, let's look at the link tag's Target attribute. This is how the link behaves once clicked.

_self  Link will open in the same browser window

<a href="http://www.developphp.com" target="_self">My Link</a>

_blank  Link will open in a new window

<a href="http://www.developphp.com" target="_blank">My Link</a>

_parent  Link will replace the frameset parent

<a href="http://www.developphp.com" target="_parent">My Link</a>

_top  Link will open in the entire unframed window

<a href="http://www.developphp.com" target="_top">My Link</a>


                                   Working with Images on your HTML Pages


Comment on Creating Links using the HTML anchor tag




Search Tags:
Creating   ·  Links   ·  using   ·  the   ·  HTML   ·  anchor   ·  tag   ·  
 
 
Arbitrary Links and Archives
Home
Active Forums
Members
SIte News
Link To Us
Gear
2009 Forum Archive
Programming Courses
Learn HTML
Learn CSS
Learn PHP
Learn MySQL
Learn Javascript
Learn jQuery
Learn ActionScript 3.0
Learn Java
Learn XML
DevelopPHP Requires Flash Player
Get Adobe Flash player
___________________________________________

Terms of Use  •  Privacy  •  Admin Notes

©2010 developphp.com   |   Powered By FlashBuildingHolder