a

a




The HTML <a> element is used to create navigation links to different pages in your website, pages on other websites, image links, open email software, fire off Javascript, as well as snapping to pinpoint locations inside of very long web pages. You can wrap small portions of text or whole elements with the anchor tag.

Link menu system courtesy of a <ul> listing element:

HTML CODE EXAMPLE
<ul>
  <li><a href="http://www.developphp.com">COM</a></li>
  <li><a href="http://www.developphp.net">NET</a></li>
  <li><a href="http://www.developphp.org">ORG</a></li>
</ul>


Live Browser
  • COM
  • NET
  • ORG

HTML CODE EXAMPLE
<ul>
  <li><a href="http://www.developphp.com">COM</a></li>
  <li><a href="http://www.developphp.net">NET</a></li>
  <li><a href="http://www.developphp.org">ORG</a></li>
</ul>


Live Browser

Email Link (opens user's default mail program): 
HTML CODE EXAMPLE
<a href="mailto:me@nameofsite.com">
  me@nameofsite.com
</a>

Live Browser
me@nameofsite.com

Email Link With Pre-Filled Content:
HTML CODE EXAMPLE
<a href="mailto:me@nameofsite.com?subject=Help Me&body=Dear Adam, etc...">
  Email Me
</a>

Live Browser
Email Me

Image Links:
HTML CODE EXAMPLE
<a href="my_pic.jpg"><img src="my_pic.jpg" alt="Image Link" /></a>

Named Anchor Links:
HTML CODE EXAMPLE
<a name="doc_point_1"></a>
<a href="index.html#doc_point_1">Go to my Point 1</a>

Link to a destination file in the same folder:
HTML CODE EXAMPLE
<a href="anyfile.html">Click Me</a>

Link to a destination file in a relative folder:
HTML CODE EXAMPLE
<a href="folder_name/anyfile.html">Click Me</a>

Link to a destination file in the parent folder:
HTML CODE EXAMPLE
<a href="../folder_name/anyfile.html">Click Me</a>

Attributes for this element:

href - where to navigate the user
Possible Values: "relative or full URL string"

target - determines how the window is opened for the destination
Possible Values: "_blank", "_self", "_parent", "_top"

title - advisory text that pops up when the user mouse hovers over the link
Possible Values: "you define text"

rel - specify relationship between the linking file and the destination file
Possible Values: "space separated token list"

hreflang - language of the destination file
Possible Values: "valid language code"

type - mime type of the destination file
Possible Values: "valid mime type"

global attributes - global core attributes
See: list of global attributes


Events handlers for this element:

global event handlers - global event handler attributes
See: list of global event handlers

0 Response to "a"

Post a Comment