HomeWeb DesignHTMLHTML Links: Definition, Syntax, Hyperlinks

HTML Links: Definition, Syntax, Hyperlinks

HTML Links: Definition, Syntax, Hyperlinks

An HTML link allows us to navigate from one page to the other page. HTML links are called hyperlinks. When You will click on a link and can jump to another page.

HTML Links – Syntax

The HTML <a> tag defines a hyperlink. the syntax is:

<a href=”Enter URL Here”> PrepareExams.Com </a>

href attribute, which defines the link’s destination. Text inside the <a> tag is displayed on the screen and When you will take the mouse over a link, the mouse arrow will turn into a little hand.

Example:

<a href="https://www.prepareexams.com/"> PrepareExams.Com </a>

HTML Colors Links

Usually, The links appear as follows:

  • An Unvisited link – blue and underlined.
  • A Visited link – purple and underlined.
  • An Active link – red and underlined.

We can change these link’s color with other colors are per requirement. here is a Example:

<style>
a:link {
  color: red; 
}

a:visited {
  color: blue;
}

a:hover {
  color: green;
}

a:active {
  color: purple;
}
</style>

HTML Links Target Attribute

Usually, the linked page is opened in the same browser window. however, we can change this. to do this, you will have to define another target attribute value for the link. Target attribute values are:

_blankOpens the document in the new window/tab
 _selfOpens the document in the same window/tab
_parentOpens the document in the parent frame
 _topOpens the document in the full body of the window

Example: 

<!DOCTYPE html>
<html>
<body>

<h2>The target Attribute</h2>

<a href="https://www.prepareexams.com/" target="_blank"> Visit PrepareExams.Com to Learn HTML!</a> 


</body>
</html>

HTML Image Links

You can insert an image link easily. for this, you will insert an image () tag in the place of text in the text link.

<h2> HTML Image Links: PrepareExams </h2>  
<img src="Prepareexams.jpg" alt="PrepareExams"/>

HTML E-mail Links (Linking to an Email Address):

You can also use mailto: email address in the anchor tag. it will let you send a new email through a link.

Example:

<!DOCTYPE html>
<html>
<body>

<h2>HTML E-mail Links - PrepareExams </h2>


<p><a href="mailto:[email protected]"> Click to Send Email </a></p>

</body>
</html>

HTML Links: Definition, Syntax, Hyperlinks 1
Yashhuuhttps://www.prepareexams.com
I love To Write Articles, I Write articles in many fields technology, news, educations, exams, gadgets reviews, coding, Apps. Facebook
- Advertisment -

Latest Articles