Posts Tagged ‘How to Create a link’

HTML A tag


Description:

The HTML a tag is used for creating a hyperlink to either another document, or somewhere within the current document.

The most important attribute of the <a> element is the href attribute, which indicates the link’s destination.

By default, links will appear as follows in all browsers:

  •     An unvisited link is underlined and blue
  •     A visited link is underlined and purple
  •     An active link is underlined and red

Difference between HTML and XHTML:

NONE

Differences Between HTML 4.01 and HTML5:

In HTML 4.01, the <a> tag could be either a hyperlink or an anchor. In HTML5, the <a> tag is always a hyperlink, but if it has no href attribute, it is only a placeholder for a hyperlink.

HTML5 has some new attributes, and some HTML 4.01 attributes are no longer supported.

 

Example:

<p>
This is a link to  <a href="http://www.MyTopTutorials.com">MyTopTutorials.com</a>
</p>

This will produce following result:

This is a link to MyTopTutorials

Online Practice:

To Become more comfortable – Do Online Practice

Attributes:

Attribute Value

Description

charset character_encoding Defines the character encoding of the linked document.
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
href URL Specifies the URL of a page or the name of the anchor that the link goes to.
hreflang language_code Language code of the destination URL
name section name Marks an area of the page that a link jumps to.
rel alternate
designates
stylesheet
start
next
prev
contents
index
glossary
copyright
chapter
section
subsection
appendix
help
bookmark
Describes the relationship between the current document and the destination URI.
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.
shape rect
rectangle
circ
circle
poly
polygon
Specifies the shape of the image map
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
type mime_type Specifies the MIME (Multipurpose Internet Mail Extensions) type of the target URL

Standard Attributes:

Attribute Description
accesskey Access keys (or shortcut keys)
class

Document wide identifier

dir Specifies the direction of the text
id Document wide identifier
tabindex Helps determine the tabbing order when the user 'tabs' through the elements on the page.
title Specifies a title to associate with the element.
style Helps to include inline casecadubf style sheet.
lang

Sets the language code.

Event Attributes:

Attribute Description
onfocus

Script runs when the element gets focus

onblur Script runs when the element loses focus
onclick Script runs when a mouse click
ondblclick Script runs when a mouse double-click
onmousedown Script runs when mouse button is pressed
onmouseup Script runs when mouse button is released
onmouseover

Script runs when mouse pointer moves over an element

onmousemove Script runs when mouse pointer moves
onmouseout Script runs when mouse pointer moves out of an element
onkeypress Script runs when key is pressed and released
onkeydown Script runs when key is pressed
onkeyup Script runs when key is released
Designed for Mytoptutorials.com