Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Defining link relationships

From: HTML5: Structure, Syntax, and Semantics

Video: Defining link relationships

As we discussed in our last movie, the rel attribute allows us to define the behavior and type of link created for our link, anchor, and area elements. In this movie, we are going to return to our trails page and define a few of our links with the rel attribute to give some of these new keywords a try. So here I have the trails.htm file open from the 05_13 folder. The first thing I am going to do is something that any of you guys that has been authoring web pages for any amount of time have done probably over and over and over, without really even thinking about it.

Defining link relationships

As we discussed in our last movie, the rel attribute allows us to define the behavior and type of link created for our link, anchor, and area elements. In this movie, we are going to return to our trails page and define a few of our links with the rel attribute to give some of these new keywords a try. So here I have the trails.htm file open from the 05_13 folder. The first thing I am going to do is something that any of you guys that has been authoring web pages for any amount of time have done probably over and over and over, without really even thinking about it.

I am going to go down to about line number 6, were we have our link tag that's linking to external main.css file. So I am going right in front of the media attribute and define the rel attribute. And the value I want to use here is stylesheet. Now as I mentioned before, you've probably done that over and over and over again for link elements; the rel attribute is not optional. You have to have it, and in the case of a style sheet, you definitely want to define the relationship to the external resource as stylesheet, so user agents know how to handle that.

Now in other instances, using the rel attribute specifically with anchor tags, for example, is simply optional. And it can make your content a little bit more semantic. It can help web applications understand the relationship of that link and what that link does. Now for your anchor elements, the use of the rel attribute is entirely optional. In a lot of cases, you're simply adding additional semantic meaning, so the user agents and applications understand that link type and understand what to do with that. And that's what we are going to do next: go down into our page, find some real links that could benefit from the added semantics that the real attribute can provide, and go ahead and apply that.

So I want to start by going down into our breadcrumbs section, and you can find this about line 28 or so. So here we have our section header for the trailReviews section. And it's says Trail Reviews, and then we have a couple of breadcrumb links here. Notice that we have a paragraph that has a link to All Trails and then the specific section we are looking at now, which is Ojai. Now anytime you are dealing with this type of breadcrumb navigation or pagination, you can actually define the relationship with some of these.

You can define up, for example, as one level up, you can define start, that sort of thing. And it's just helps user agents know what this link is in relationship to some of other links around it. So the first thing I want to do is right here in our first link, which is to Alltrails, in the anchor element itself, I am going to go ahead and define another rel attribute. In this case I am going to give it the keyword value of start, since it is the very first link within the breadcrumbs, and that would tell any of the applications that this link was sort of, if you would, the first page link with in this section.

So this will help user agents and applications understand that this link is the very first link within the breadcrumb navigation. And you might even have certain user agents, for example, that give people the options of jumping right back to the start and going back to this link without having them to necessarily manually click on the link. Ok, I'm going to scroll down just a little bit further down into the article itself, and we have, around line 77 or so, we have in the footer of that section, contact information for Jeff Layton.

One of the things, for example, you will notice is that we have an email link to his email address. So this is contact information for the author. It's also helpful to describe the relationship for this link as well, and since this is the author of that particular article, we can come in and right after title, for the title attribute, I'll define a real attribute and I'll give its value as author, explaining to different user agents that this link provides a way of contacting or identifying the author of the content on the page.

All right, so I am going to go ahead and save that. I am going to scroll down to our ad copy, which is almost all the way down towards the bottom of the page, around line 136 or so. And one of the things I want to do here is the block-level link that we created earlier that's wrapping both the image and the tagline, that's going out to an external site, the Explore California site. So one of the things I can do here is define that relationship as well. So I am going to go ahead and add a rel attribute here, and the rel attribute that I want to use is external.

So that's going to tell search engines or other user agents that this link is going to take the user to an external site from the site that they are currently on. Let's do just one more. Let's scroll down a little bit and find our legal information, which is right here about line 149 in the page footer. We have 'please read our terms of use'. So this link is taking us to a document that basically defines the licensing agreement, or the terms of use for that particular page.

And it's nice if we could go ahead and define that relationship using a rel attribute as well. So I am just going to use the rel attribute, and here I am going to type in 'license'. And once again that just describes the relationship of the page that we're linking to, which is our terms of use page, to the current page which is saying that, hey, everything on the current page is covered under the license, or the terms of use agreement, on the page that I am linking to. All right, cool. So I am going to go ahead and save that page and test this in my browser.

You don't really notice anything different. If you scroll through the page, nothing looks different. You're not seeing any stylistic differences. Now obviously, if we would have omitted the rel attribute on our external style sheet link, things might look a little different. But other than that, we can't really see the benefits of that visually. But we have made our links much more descriptive. And we have established the relationship between our page and its linked resources in pages, which is a good thing. Now in the cases of style sheet again the rel attribute is incredibly important and omitting it would have seriously negative consequences. Now, in other cases, such as our author's contact information, the rel attribute simple provides us with an opportunity to provide semantically richer content, which can be used by any supporting user agent.

Show transcript

This video is part of

Image for HTML5: Structure, Syntax, and Semantics
HTML5: Structure, Syntax, and Semantics

46 video lessons · 35873 viewers

James Williamson
Author

 
Expand all | Collapse all
  1. 2m 20s
    1. Welcome
      48s
    2. Using the exercise files
      1m 32s
  2. 18m 41s
    1. A brief overview of HTML5
      3m 57s
    2. What's in the HTML5 specification?
      8m 17s
    3. Why do we need new structural elements?
      6m 27s
  3. 50m 33s
    1. Defining HTML5 documents
      5m 5s
    2. HTML5 syntax
      9m 14s
    3. The header element
      5m 22s
    4. The nav element
      4m 55s
    5. The section element
      4m 51s
    6. The article element
      4m 48s
    7. The aside element
      4m 13s
    8. The footer element
      4m 17s
    9. Content model overview
      7m 48s
  4. 35m 28s
    1. Understanding the outline algorithm
      3m 17s
    2. Creating document sections
      8m 25s
    3. Using headings properly
      9m 1s
    4. Using hgroup to override sectioning
      4m 17s
    5. Properly nesting structure
      7m 17s
    6. Sectioning roots
      3m 11s
  5. 58m 30s
    1. Organizing content
      4m 41s
    2. Planning document structure
      5m 47s
    3. Choosing the right structural element
      4m 43s
    4. Checking document outlines
      5m 27s
    5. Coding initial page structure
      5m 28s
    6. Using class and ID attributes
      5m 31s
    7. Structuring headers
      13m 13s
    8. Building navigation
      7m 1s
    9. Structuring footers
      6m 39s
  6. 1h 27m
    1. Working with figure and figcaption
      7m 12s
    2. Grouping content with asides
      3m 46s
    3. Using divs in HTML5
      5m 0s
    4. Working with lists in HTML5
      7m 10s
    5. The return of bold and italic
      5m 52s
    6. Citing works semantically
      6m 32s
    7. Using the address element
      5m 24s
    8. Using the small element
      4m 24s
    9. Using the mark element
      5m 16s
    10. Working with date and time
      11m 55s
    11. Creating block-level links
      8m 53s
    12. Understanding link relationships
      9m 28s
    13. Defining link relationships
      6m 23s
  7. 17m 22s
    1. Current browser support
      7m 38s
    2. Ensuring block-level display
      4m 3s
    3. Adding support for elements in older browsers
      5m 41s
  8. 3m 46s
    1. Additional Resources
      3m 46s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed HTML5: Structure, Syntax, and Semantics.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.