Link Tags in HTML

Difference between link tags such as <a> & <link> in HTML?

Last updated:7/20/2021 12:51:57 AM

1 Answers

Ethan Karla
Ethan Karla

Anchor tag is used as <a>...</a> in webpage. These are used to redirect the page to the other link after click on that.

OR

Link tag is used as <link>...</link> in webpage. And there are used to link the file in the particular after linking the file the whole content of file has been added.

Let's understand it with the help of an example :

Here, I am creating a stylesheet link tag and an anchor tag, In webpage stylesheet will use that content in my webpage but the anchor tag will work only after clicking on it.

Homepage HTML File

<!DOCTYPE html>

<html lang='en' xmlns='http://www.w3.org/1999/xhtml'>
<head>
    <meta charset='utf-8' />
    <title>Link Tags</title>
    <!--// Link Tag-->
    <link rel='stylesheet' type='text/css' href='style.css' />
</head>
<body>
    <!-- Anchor tag-->
    <a class='d-flex justify-content-center' href='https://www.mindstick.com/'>Mindstick Software Private Limited</a>
</body>
</html>

Stylesheet File

body {

    margin-left: 30%;
    margin-right: 30%
}
.d-flex {
    display: flex;
}
.justify-content-center {
    justify-content: center;
}

Hope this information will be helpful for you.

Happy Coding!

Answer