<link> - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:link

Introduction

You can use link element to denote External Resources.

The link element creates a relationship between an HTML document and an external resource, most typically a CSS stylesheet.

The link Element summary

Item Value
Element link
Element Type Metadata
Permitted Parents head, noscript
Local Attributes href, rel, hreflang, media, type, sizes
Contents None
Tag Style Void element
New in HTML5 No
Changes in HTML5 The sizes attribute has been added; the attributes charset, rev and target are obsolete in HTML5
Style Convention None

The link element defines six local attributes.

attributes rel defines the nature of the relationship between the HTML page and the resource that the link items relates to.

Attribute Description
hrefSpecifies the URL of the resource that the link element refers to.
hreflangSpecifies the language of the linked resource.
media Specifies the device that the linked content is intended for. This attribute uses the same device and feature values.
rel Specifies the kind of relationship between the document and the linked resource.
sizes Specifies the size of icons. I show you an example of using the link element to load a favicon later in the chapter.
typeSpecifies the MIME type of the linked resource, such as text/css or image/x-icon.

Demo Code

ResultView the demo in separate window

<html>
   <head></head>
   <body></body>
</html><!--from   w w w  .j  a  v  a2  s.c  om-->

Related Tutorials