banner



Internal Linking In Html With Example

What is a link?

It is a connection from one web resource to another.A link has two ends,An anchor and direction. The link starts at the "source" anchor and points to the "destination" anchor, which may be any Web resource such as an image, a video clip, a sound bite, a program, an HTML document or an element within an HTML document.

Attention reader! Don't stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML course.

HTML Link Syntax

Links are specified in HTML using the "a" tag.


Syntax Explanation:

          href :          The href attribute is used to specify  the destination address of the link used.          Text link :          The text link  is the visible part of the link.

Input :

html

<!DOCTYPE html>

< html >

< h3 >Example Of Adding a link</ h3 >

< body >

< p >Click on the following link</ p >

</ body >

</ html >

Output :

Internal Links


An internal link is a type of hyperlink whose target or destination is a resource, such as an image or document, on the same website or domain.
Input:

html

<!DOCTYPE html>

< html >

< h3 >Internal Link And External Link Example</ h3 >

< body >

< p >< a href = "html_contribute.asp/" >GeeksforGeeks Contribute

</ a > It is a link to the contribute page on GeeksforGeeks' website.</ p >

</ a > It is a link to the GeeksforGeeks website on the World Wide Web.</ p >

</ body >

</ html >

Output :

Changing Link Colours in HTML

Different types of links appear in different formats such as:

  1. An unvisited link appears underlined and blue in colour by default.
  2. A visited link appears underlined and purple in colour by default.
  3. An active link appears underlined and red in colour by default.

The appearances of links can be changed by using CSS.
Input :

html



<!DOCTYPE html>

< html >

< head >

< style >

a:link {

color: red;

background-color: transparent;

}

a:visited {

color: green;

background-color: transparent;

}

a:hover {

color: blue;

background-color: transparent;

}

a:active {

color: yellow;

background-color: transparent;

}

</ style >

</ head >

< body >

< p >Changing the default colors of links</ p >

< p >Visited Link</ p >

< p >Link</ p >

< p >hovering effect</ p >

</ body >

</ html >

Output:

The Target Attribute in Links

The target attribute is used to specify the location where the linked document is opened.The various options that can be used in the target attribute are listed below in the table:

Input:

html

<!DOCTYPE html>

< html >

< body >

< h3 >Various options available in the Target Attribute</ h3 >

< p >If you set the target attribute to "_blank",

the link will open in a new browser window or tab.</ p >

< p >If you set the target attribute to "_self",

the link will open in the same window or tab.</ p >

< p >If you set the target attribute to "_top",

the link will open in the full body of the window.</ p >

< p >If you set the target attribute to "_parent",

the link will open in the parent frame.</ p >

</ body >

</ html >

Output:


Using Image as a Link in HTML

An image can be used to create a link to a specified url.
Input:

html

<!DOCTYPE html>

< html >

< body >

< h3 >Using Image as a link</ h3 >

< p >Click on the image to visit GeeksforGeeks homepage.</ p >

< img src = "gfg_200X200.jpeg" alt = "GeeksforGeeks"

style = "width:80px;height:80px;border:0" >

</ a >

</ body >

</ html >

Output:

Creating a Bookmark Link for a Webpage


A bookmark is a link that can be used to jump to specified portion of a webpage.Bookmarks are very useful if a webpage is quite long.
Steps to create a bookmark are:
1. Using the id attribute,create a bookmark.

2. Add the specified portion of the webpage to the bookmark.

Input :

html

<!DOCTYPE html>

< html >

< body >

< p >< a href = "#T11" >Jump to Topic 11</ a ></ p >

< p >< a href = "#T17" >Jump to Topic 17</ a ></ p >

< p >< a href = "#T20" >Jump to Topic 20</ a ></ p >

< h2 >Topic 1</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 2</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 3</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 4</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 5</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 6</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 7</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 8</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 9</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 10</ h2 >

< p >paragraph 1

.....</ p >

< h2 id = "T11" >Topic 11</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 12</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 13</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 14</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 15</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 16</ h2 >

< p >paragraph 1

.....</ p >

< h2 id = "T17" >Topic 17</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 18</ h2 >

< p >paragraph 1

.....</ p >

< h2 >Topic 19</ h2 >

< p >paragraph 1

.....</ p >

< h2 id = "T20" >Topic 20</ h2 >

< p >paragraph 1

.....</ p >

</ body >

</ html >

Output:

Creating a download link in HTML
A text link of a pdf,doc or zip file can be created to make it downloadable.
Input :

html

<!DOCTYPE html>

< html >

< h3 >Creating a download link</ h3 >

< body >

< a href = "GeeksforGeeks | A computer science portal for geeks.pdf" >Download PDF File</ a >

</ body >

</ html >

Output: :

Supported Browser:

  • Google Chrome
  • Microsoft Edge
  • Firefox
  • Opera
  • Safari

Internal Linking In Html With Example

Source: https://www.geeksforgeeks.org/html-links/

Posted by: christensenplousee.blogspot.com

0 Response to "Internal Linking In Html With Example"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel