Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

HTML Mastery Guide 🏅

Anchor Tag

What's Inside

  • What is an Anchor (<a>) tag?
  • Major roles of Anchor tag
  • Commonly used attributes with anchor tag
  • <iframe> tag

Overview

What is an Anchor tag?

An anchor tag is used to render a "Hypertext link" using the href attribute. It can link to Web Pages, files, email addresses, locations on the same page, or anything else a URL can address.

Important

An anchor tag is an inline element.

<a href="URL">Click Here!</a>

Major roles of Anchor tag

To address html pages or any other document.

In href give the relative path of about.html file.

<a href="about.html">About Us</a>

In href give the relative path of contact.html file.

<a href="contact.html">Contact</a>

Folder structure

📁05 - Anchor Tag
└── about.html
└── contact.html
└── image.jpeg
└── index.html
└── README.md

To address any other webpage on the internet.

In href use the web address of any website to open the webpage.

<a href="https://www.google.com">Google</a>

Anchor used to link any section of webpage

<a href="#bottom">Move to bottom</a>

Note

We can link any section using id's

Commonly used attributes with anchor tag

href attribute

href attribute is a required attribute for anchor tags.

Warning

Without href attribute anchor tag acts like a normal tag

target attribute

target attribute is used to define where to open the given path.

Generally used value with target attribute are-

target= "_blank"

To learn more about anchor tag attributes explore🔍!

iframe tag

How to Embed online videos on webpage?

We can Embed online videos through a corresponding <iframe>; tag.

Note

<iframe> tag specifies an inline frame.
An inline frame is used to embed another document within the current HTML document.


Process of Embedding Youtube Video on Your webpage!

Search for a video on YOUTUBE

preview 1

Click on Share

preview 2

Select the Embed option from them

Just - paste it on your HTML file

preview 3 preview 4