Page 1 of 1

HTML <link> Tag

PostPosted: November 4th, 2012, 8:13 am
by GrandPiano
I'm taking the W3Schools tutorial for HTML. I'm at the HTML head Elements chapter, but I can't quite understand what the <link> tag does. W3Schools says that "The <link> tag defines the relationship between a document and an external resource." What does that mean?

Re: HTML <link> Tag

PostPosted: November 4th, 2012, 11:58 am
by Jellonator
SuperMarioMan wrote:I'm taking the W3Schools tutorial for HTML. I'm at the HTML head Elements chapter, but I can't quite understand what the <link> tag does. W3Schools says that "The <link> tag defines the relationship between a document and an external resource." What does that mean?

The link tab is used to link external scripts like CSS and JS to a document, for example:
Code: Select all
<link rel="stylesheet" type="text/css" href="theme.css">

That would tell the browser to use that stylesheet to style the webpage. It is possible to link multiple stylesheets to a webpage, but it is reccomended you use only one or two.
EDIT: go here for more information.

Re: HTML <link> Tag

PostPosted: November 4th, 2012, 2:32 pm
by GrandPiano
OK, thanks. I have another question about the <link> tag: I now understand what the <link> tag does when the rel attribute is set to "stylesheet," like in <link rel="stylesheet" type="text/css" href="theme.css">, but what about when rel is set to:
  • alternate
  • archives
  • author
  • bookmark
  • external
  • first
  • help
  • icon
  • last
  • license
  • nofollow
  • noreferrer
  • pingback
  • prefetch
  • search
  • sidebar
  • tag
  • up
I think I know what it means when rel=next or prev, but precise clarification would be nice. Also, in the Browser Support section for the W3Schools page on the <link> tag, it says "When used for style sheets, the <link> tag is supported in all major browsers. No real support for anything else." Does this mean that, out of all those values, the only supported value for the rel attribute is "stylesheet"?

Re: HTML <link> Tag

PostPosted: November 21st, 2012, 10:00 pm
by AlucardX60
This is the list of <link> attributes that I'm sure your probably familiar with. http://www.w3schools.com/tags/tag_link.asp
Clicking on an attribute brings you to a page that explains it's values. This is the values for rel. http://www.w3schools.com/tags/att_link_rel.asp

As far as your other question. I'm unclear about this myself as I have never had to use any other attributes. Either search for more information or test it on various browsers yourself.