HTML <link> Tag

Need programming help? Want to post programming tips? Are you programming a game and want to show it off? That and more here.

HTML <link> Tag

Postby GrandPiano » November 4th, 2012, 8:13 am

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?
Last edited by GrandPiano on November 10th, 2012, 5:47 pm, edited 1 time in total.
Hello.
User avatar
GrandPiano
Code: Awesome

 
Posts: 410
Joined: January 17th, 2010, 2:25 pm
Location: USA

Runouwian Fighter

Thumbs Up given: 4 times
Thumbs Up received: 15 times

Re: HTML <link> Tag

Postby Jellonator » November 4th, 2012, 11:58 am

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.
bepis lmao
User avatar
Jellonator
Code: Awesome

Error contacting Twitter
 
Posts: 342
Joined: August 28th, 2010, 6:25 am
Location: With Waldo.

Thumbs Up given: 18 times
Thumbs Up received: 42 times

Re: HTML <link> Tag

Postby GrandPiano » November 4th, 2012, 2:32 pm

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"?
Hello.
User avatar
GrandPiano
Code: Awesome

 
Posts: 410
Joined: January 17th, 2010, 2:25 pm
Location: USA

Runouwian Fighter

Thumbs Up given: 4 times
Thumbs Up received: 15 times

Re: HTML <link> Tag

Postby AlucardX60 » November 21st, 2012, 10:00 pm

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.
User avatar
AlucardX60
Prophet of Shadowsquid

Error contacting Twitter
 
Posts: 1343
Joined: August 10th, 2009, 9:08 am
Location: I'll get back to you on that.

SM63 Level Designer Contest Winner
LDC #4: Halloween

Thumbs Up given: 4 times
Thumbs Up received: 32 times


Return to Programming