HTML Introduction

HTML Basic Syntax

HTML Block Element

HTML Formatting

HTML Quotation

HTML Links

HTML List

HTML Table

HTML Audio

HTML Video

HTML Image

HTML Iframe

HTML Favicon

HTML Form

HTML Input Types

HTML Marquee

HTML Meta tag

Learn CSS

Learn Javascript

Learn Django

HTML linking

We use anchor(a) tag for add link. There is a attribute name href in anchor tag. Write the link there means in href attribute. To go to another website or web page like youtube, facebook, etc we have to copy that page(youtube, facebook, etc) url and paste it in href attribute. Suppose we have created two pages. Now we want to go to second page from first page. In this case we have to copy the page location and paste it in href tag. Then give forward slash and write the page name.extension. If that page is present in the same location where you have your html file then just write name and extension and if the file is present in the another location then at first pass the file path and then give forward slash and then file name.extension. Remember one thing, to perform any link related work we use anchor tag.

Anchor tag attributes:
target:
Values of target attribute:
1. _blank:
If this value is used then if someone clicks on the link then the linked page will be open in a new tab.
2. _self(default)
It will open the linked page in the same page.
3. _parent:
If this value is used then if someone clicks on the link then the linked page will open in the parent frame
4. _top:
If this value is used then if someone clicks on the link then the linked page will open in the full body of the window

href:
Here we pass the link or file location of a particular page, link or file, image, etc. After clicking on link you will see that page or file or image which link is given in the href attribute.

default link color on browser according to the action:
1. An unvisited link color is blue
2. A visited link color purple
3. An active link color is red
These colors are default color but you can change the color.

title:
This title attribute is used to show some extra information about link element when user hover or put the cursor on the link element.


Note: Suppose the html file and that file which you want to link are present in the same location then while writing the link in href, you don't need to pass the path. You have to just write the file name and extension.
Example:
<a href="my_file.jpg">Image 1</a>

If the html file and another file is not present in the same location then you have to pass the whole location + file name + extension in href attribute of that file.
Example:
<a href="F:\HTML/second_page.html">Home</a>

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>

<!---Getting an image. Here my HTML file and image are present in same location--> <a href="my_pic.jpg">Image</a>

<!---Getting a HTML file. Here my HTML file is present in another location--> <a href="F:\HTML/second_page.html" target="_blank">Web page</a>

<!---Getting a HTML file. Here my main HTML file and new HTML file are present in same location--> <a href="home_second_page.html" target="_blank">Web page</a>

<a href="aaa1212@gmail.com">Gmail</a>

<a href="https://www.bing.com/search?q=google&form=ANNTh2&refig=0c869349eca74c03a125556063e249b0" target="_blank">Google</a>

</body>
</html>

Anchor tag mailto:

To send mail we use this tag. Suppose we have a button contact us and we want that user can send mail if user click on the button. Now if we use mailto then when user click on the button a new page will be open and there user can type and send the mail.

How to use mailto?

In the href attribute, first we have to write mailto:. Then after the clone sing, we have to write the mail account name where we want receive mail from user then give question mark. Now if you want to use cc then write cc=type another mail account name where you want to receive mail. If you want that the subject will generate automatically then write subject=subject name. If you want that the mail content will be automatically generate then write body=content. To separate attributes we use "&" sign.

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>

<a href="mailto:rafsun4543@gmail.com?">Contact us 1</a>

<a href="mailto:rafsun4543@gmail.com?cc=mailto:ahmad@gmail.com">Contact us 2</a>

<a href="mailto:rafsun4543@gmail.com?cc=mailto:ahmad@gmail.com&subject=Confusion" >Contact us 3</a>

<a href="mailto:rafsun4543@gmail.com?cc=mailto:ahmad@gmail.com&subject=Confusion&body=What is HTML" >Contact us 4 </a >

</body>
</html>

CodersAim is created for learning and training a self learner to become a professional from beginner. While using CodersAim, you agree to have read and accepted our terms of use, privacy policy, Contact Us

© Copyright All rights reserved www.CodersAim.com. Developed by CodersAim.