Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Gain a deeper understanding of HTML5 and learn how to create richer, more meaningful web pages with structural tags and descriptive attributes. In this course, author James Williamson presents an overview of HTML5 and its development, defines the new tags and attributes, and discusses how browsers parse and display HTML5 content. The course also includes step-by-step instructions for constructing an HTML5 document with a header and footer, navigation, content groups, and formatting.
So far, we've discussed how HTML5 allows us to describe the contents of our documents in a more semantic way. In this movie, I want to explore how HTML5 expands your ability to add more meaning to how your pages relate to their resources and links, essentially giving you the ability to define the relationship between your current page and the external resources and pages that it links to. We will accomplish this by using the rel attribute. Now, the rel attribute isn't anything new. It's been around for quite some time, and I'm sure that in the past you've used it with the link tag, and possibly even the anchor element.
But in HTML5, the area tag has also been added to the elements that can use the rel attribute. So, what does it do? Well, if we go to the specification, and here I am looking at the author view of the HTML5 specification, and I am navigated to the link element section 4.2.4. If I scroll down just a little bit, I will get right into the section that discusses the rel attribute. Now, one of the things I want to point out before we get too deep into the rel attribute and what its allowed values are, is this little sentence right up here, "A link element must have a rel attribute." Now, contrast that with the anchor tag and the area element; both of those elements are optional in terms of using the rel attribute, so you have to use it on a link tag. On an anchor tag or an area tag, it's an optional value.
Also, one of the really nice benefits of using it is it helps you describe the nature of links throughout a site. It's sort of describing how those pages relate to each other, and that's extremely helpful for search engines. So, there is a lot of value in using the rel attribute. Now, you are also limited, when you use it, to certain keywords. And if you notice right up here, the specification gives us a link to those allowed keywords and their meaning. So, in order to dig a little deeper into the rel attribute, let's go take a look at those.
So, here I am at section 4.12.3, Link types. Essentially, if I scroll down a little bit, we get this really nice table down here. What we have in the first column are the actual keyword values themselves. Then we have whether they can be applied to link or anchor and area. Notice that essentially, sometimes certain values are not allowed. So, for example, you couldn't use the bookmark keyword on a link element. And then there is a very brief description. Now, if you click on the name of the attribute keyword value itself, it will take you to a little bit of a longer description.
Before we check out any of those, let's take a look at some of these. And I want to focus on the ones that are new to HTML5. We have a dramatically expanded list of allowed keywords in HTML5 versus HTML 4. It's a lot larger, and a lot of those changes are reflecting the changing nature of web and how people and how links type and the way people have been using sites have changed a little bit. So, let's take a look, a very brief look at some of the new ones. We have author, which essentially says that this link is taking us to a document that describes or provides the contact information for the author of the document itself.
We have external, which is telling people that this link is going to a page outside, or an external site from the page that we are currently on. We have icon, which indicates that the resource is an icon that represents the site or the page, so this is used a lot for the fav icons that people use for their web sites. We have license. That indicates that the information in the current page is covered under the license that's described in the link document, so that's really helpful if you have links going out to legal documents or usage terms, things of that nature.
Now, I am going to scroll down just a little bit more. And this next section of links I want to talk about really showcases how some of these attribute values have been added, in terms of how web sites have been evolving. Now, the first one, for example, is nofollow. If any of you guys out there have been doing a lot of blogging, this probably is very familiar to you. It's essentially instructing a search engine not to follow the link. You are not endorsing that particular link or that side. You don't want it to affect your rankings based on where the site might go; maybe it's the site you don't trust, maybe you are really not sure where it's going, that sort of thing.
We have noreferrer, which instructs the user agent not to send an HTTP referrer along with the link. pingback, which is going to give the address of the server that handles pingbacks with the document. Again, this is really widely used in blogs. And we have a very interesting one here, prefetch. A prefetch informs the user agent to basically cache up the resources when the page loads before the link has been clicked. This is not very widely supported right now, and it remains to be seen whether this is going to be supported in any significant manner within user agents.
We have the search, which indicates that the linked resource allows users to search through the document and pages that might be related to that. And we have another one that is highly reflective of blogging, which is tag. That indicates that the given URL is also a user-designated tag for the current page. So, you can use this, for example, for tagging specific pages, or portions of pages. Now, it's really interesting to note here that the URL of the resource is actually the tag, not title that you might give the particular link.
So, if you were linking, for example, to page, that's also a category in your blog--maybe, for example, you're doing a movie review blog and you might have a reviews.html page. So, essentially the reviews would be the tag. Essentially, you are telling user agents that hey, this is also a tag within my blog, or within my site. Okay, now I mentioned before that if you click on one of these links-- so, for example, let me click on tag-- that will take you down to a little bit broader description. A lot of times you will have notes usage in here and some extra material, so be sure to go ahead and read those for a more thorough description of them.
Now, if you're not careful, it's easy to just look at his particular table and miss a lot of the other acceptable keywords for the rel attribute. So, I'm going to just go from where I am at right now, which is looking at the larger description of tag, and just scroll down a little bit. And if I scroll down another couple of sections to this 184.108.40.206 Other link types, I also see within the specification that it says that extensions to the predefined set of link types may be registered in the Microformats wiki existing-rel-values page.
Now what does that actually mean? Well, what it means is that any values described in the Microformats page is also acceptable to the HTML5 specification. Now, this is a constantly changing resource, and people are adding new ones all the time. So in order to keep up and keep track of all these attribute values, I want to give you a couple of resources. Now, the first is the Microformats page itself, and you can find this at microformats.org. And just scrolling through this page shows you that there are a ton of values that we did not see in the HTML5 specification.
Now, just to give you an idea of what's going on here, you are going to find the value itself, a brief description of that, and then the specification from where that comes. Now, this page can be a little confusing. There are a lot of tables on here and if you read through them, you'll find out what's going on. Some of these are just brainstorming ideas, some of them are listing values that have been prior specifications and now appear to be dropped, and then some are proposed. So, there is a lot happening. There is another page that you can go to that has probably a neater and more concise list, and that is a Webtap magazine.
If you go to Webtap magazine and browse through their archives, go into September of 2010 and you'll find a link to the page, Your Ultimate Guide to the Rel Attribute in HTML5. Now, if I scroll down here, I can see there is a much more concise table. This gives me not only the value but the specification which it was found in, in terms of was it found in HTML5 as well as HTML 4, and then you can scroll down and you can find ones that are only on the HTML5 specification, and kind of what's going on with that.
And then it also lists some that are existing in other specifications as well. So, it's a nice color-coded list of all the acceptable values, which elements they are allowed on, and what spec they belong to. Now, again this is a constantly changing list. This article is from September of 2010. So really, to keep up to date with this, make sure that you continue to reference back to the HTML5 specification as well as the Microformats page, so you can get a nice idea as to what is currently acceptable and which ones have been added.
All right, so now that we have explored some of our options for defining link relationships, we are going to go back to our trails page and finish it up by adding rel attributes to some of our links, and we are going to tackle that next.
There are currently no FAQs about HTML5: Structure, Syntax, and Semantics.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.