HTML <link> tag is used to specify the relationship between the current document and external source.

The <link> tag is commonly used to link the external Stylesheet for the current document, but it can also use with link site icons. It is placed on the head section of the document.

Example

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

Following are some specifications about the HTML <link> tag

DisplayNone
Start tag/End tagBoth Start and End tag
Usagetextual

Example

 

    <!DOCTYPE html>  
    
    <html>  
    
    <head>  
    
        <title>Link Tag</title>  
    
        <link rel="stylesheet" type="text/css" href="htmlpages/css/link.css">  
    
    </head>  
    
    <body>  
    
        <h2>Example of Link Tag</h2>  
    
        <p>This is paragraph which is styled with external style sheet. </p>  
    
    </body>  
    
    </html>

      

      body{  
      
          background-color: #7ac5cd;  
      
              text-align: center;}  
      
      h2{  
      
          color: #006400;}  
      
        
      
      p{  
      
          color: #cd5c5c;  
      
          font-size: 25px;  
      
          font-style: italic;}

      Output:

      HTML link tag

      Attribute:

      Tag-specific attributes:

      AttributeValueDescription
      charsetchar_encodingIt defines the character encoding of linked source. (Not supported in HTML5)
      hrefURLIt specifies the location of the linked document.
      hreflanglanguage_codeSpecifies the text language of linked source.
      mediamedia_queryIt specifies the media, for which linked source is applied.
      relalternateauthordns-prefetchhelpiconlicensenextpingbackpreconnectprefetchpreloadprerenderprevsearchstylesheetIt describes the relationship between the current document and linked document. (required)
      revreversed
      relationship
      It describes the relationship between the linked document and the current document. (Not supported in HTML5)
      sizesHeight* weightIt specifies the size of the linked source. It should be only used with rel=”icon.”
      target_blank
      _self
      _top
      _parent
      frame_name
      It determines where to load the linked document.
      typemedia_typeIt specifies the media type of document.

      Global attribute:

      The <link> tag supports the global attributes in HTML

      Event attribute:

      The <link > tag supports the event attributes in HTML.

      Supporting Browsers

      Elementchrome browser Chromeie browser IEfirefox browser Firefoxopera browser Operasafari browser Safari
      <link>YesYesYesYesYes

      Comments

      Leave a Reply

      Your email address will not be published. Required fields are marked *