Open In App

How to specify the relationship between the current document and the target URL in HTML5 ?

We specify the relationship between the current document and the target URL by using a <link> tag in HTML. A link tag is used to define a link between a document and an external resource. It is used only when the href attribute is present.

Approach:



Attribute Values:

Syntax:



 <link rel="stylesheet" type="text/css" href="styles.css">

 Example 1: In this example, we will specify the relationship between the current document and the target URL




<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet"
          type="text/css" href="styles.css">
</head>
   
<body>
    <h1>GeeksforGeeks</h1>
    <h2>
        How to specify the relationship between the current
          document and the target URL in HTML5?
      </h2>
</body>
</html>

CSS Code: The following is the content for the code “styles.css” used in the above HTML code.

h1 , h2 
{
   color:green;
   text-align: center;
   font-style: italic;
   font-weight: bold;
}

Output:

link document

Example 2: In this example, we will see the use of <link> tag in HTML.




<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet"
        type="text/css"
        href="index_screen.css">
    <link rel="stylesheet"
        type="text/css"
        href="index_print.css">
</head>
<body>
    <center>
        <h1>GeeksforGeeks</h1>
        <p><a href="https://ide.geeksforgeeks.org/tryit.php"
        target="_blank">
    Click here
    </a>
    </center>
</body>
</html>

Output:

 


Article Tags :