Learn Hyperlinks in HTML


Links are found in nearly all web pages. Links allow users to click their way from page to page.

HTML Links – Hyperlinks

HTML links are hyperlinks.
A hyperlink is a text or an image you can click on, and jump to another document.

HTML Links – Syntax

In HTML, links are defined with the <a> tag:
In your html document add the following

<a href=" ">Visit our blogs </a>

Add your link between the two quotation marks and link text of your link, the link text is where your visitors will click on.

Example 

<a href="http://techmekrz.com/" target="_blank">Visit our blogs </a>

The 
href attribute specifies the destination address (http://techmekrz.com/)

The link text is the visible part (Visit our blogs).

Clicking on the link text, will send you to the specified address.
  1. The link text does not have to be text. It can be an HTML image or any other HTML element.
  2. Without a trailing slash on subfolder addresses, you might generate two requests to the server. Many servers will automatically add a trailing slash to the address, and then create a new request.

HTML Links - Colors

When you move the mouse over a link:

1.  The mouse arrow will turn into a little hand sign.
2.     The color of the link element will change

By default, a link text will visible like this (in all browsers): 

1.     An unvisited link is underlined and blue
2.     A visited link is underlined and purple
3.     An active link is underlined and red

You can change these default colors, by using following styles:

Example

<style>

a:link    {color:red; background-color:transparent; text-decoration:none}
a:visited {color:green; background-color:transparent; text-decoration:none}
a:hover   {color:blue; background-color:transparent; text-decoration:underline}
a:active  {color:purple; background-color:transparent; text-decoration:overline}

</style>

HTML Links - The target Attribute

The target attribute indicate where to open the linked document.

This example will open the linked document in a new browser window or in a new tab:

Example
<a href=" http://techmekrz.com/ “ target="_blank">Visit our blogs </a>

Target Value

Description

_blank
linked document will be open in a new window or tab
_self
linked document will be in the same frame as it was clicked (this is default)
_parent
linked document will be open in the parent frame
_top
linked document will be open in the full body of the window
framename
linked document will be open in a named frame


Comments

Popular posts from this blog

How to Create a One-Page Website

HTML Cheat Sheet

The art of salary negotiation