Computer >> Computer tutorials >  >> Programming >> HTML

How to add a resource reference in HTML?


Use the <link> tag to add a resource reference. The HTML <link> tag is used for defining a link to an external document. It is placed in the <head> section of the document.

The following are the attributes −

Attribute
Value
Description
charset
charset
Defines the character encoding of the linked document.
href
URL
Specifies the URL of the resource document.
hreflang
language
Language code of the destination URL
media
screen
tty
tv
projection
handheld
print
braille
aural
all
Specifies the device the document will be displayed on
rel
alternate
appendix
bookmark
chapter
contents
copyright
glossary
help
home
index
next
prev
section
start
stylesheet
subsection
Describes the relationship between the current document and the destination URL.
rev
alternate
appendix
bookmark
chapter
contents
copyright
glossary
help
home
index
next
prev
section
start
stylesheet
subsection
Describes a reverse between the destination URI and the current document.
sizesHow to add a resource reference in HTML?
HeightxWidth
Specifies the size of the linked resource.
target
blank
_self
_top
_parent
Specifies the target frame to load the page into.
type
mimetype
The MIMEtype of content at the link destination

Example

You can try to run the following code to add a resource reference in HTML −

<!DOCTYPE html>
<html>
   <head>
      <title>HTML link Tag</title>
      <link rel = "stylesheet" href = "stylenew.css">
   </head>
   <body>
      <div id = "contentinfo">
      <p>Welcome to our website. We provide tutorials on various subjects.</p>
      </div>
   </body>
</html>