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

Using the address element

From: HTML5: Structure, Syntax, and Semantics

Video: Using the address element

The address element has been around for a long time now, but has always been rather ill-defined. In HTML 4, the address element was described as an element that may be used by authors to supply contact information for a document or a major part of the document, like a form. Now, in HTML5, the element is defined in a little bit more detail. So again, here I am in the spec and I've navigated to the address element, and let's read a little bit more about it. First things first: let's take a look at the content model. Notice that you can put inside the address element any flow content, but no heading content descendents, no sectioning content descendents, and no header, footer, or address element descendents.

Using the address element

The address element has been around for a long time now, but has always been rather ill-defined. In HTML 4, the address element was described as an element that may be used by authors to supply contact information for a document or a major part of the document, like a form. Now, in HTML5, the element is defined in a little bit more detail. So again, here I am in the spec and I've navigated to the address element, and let's read a little bit more about it. First things first: let's take a look at the content model. Notice that you can put inside the address element any flow content, but no heading content descendents, no sectioning content descendents, and no header, footer, or address element descendents.

So it's basically saying you have to have a pretty flat structure inside the address element, even though you can put more than just one element in it. So if I scroll down to look at the description of it, it says, "The address element represents the contact information for its nearest article or body element ancestor." Now if that's the body element, then the contact information applies to the document as a whole. So you could, for example, supply address information for one article, another article, and then the entire body. That's a big change from HTML 4, when you really only had one address element per page.

So that's another big change. If I go down a little bit further, I can see that the address element must not-- now, not 'may not', but 'must not'--be used to represent arbitrary addresses like postal addresses, unless those addresses are in fact the relevant contact information. So it mentions how the paragraph element is the appropriate element for marking up postal addresses in general. The address element must also not contain information other than the contact information. Now, that's actually a little broader than you think. Notice that what they're showing you here in terms of a nonconforming use, inside this address element they have a last modified and then a date.

Well, obviously that has nothing to do with the contact information. However, you can have a much larger section where the contact information is addressed, and then use the address tag for that. So you can sort of mix and match it with other structural elements, and you'll notice here, typically the address element would be included, along with other information in a footer, for example. So here we have a footer, we have an address that says, "For more details," and then the person's contact info, and then some legal data after that. So basically, it's typically found in a footer, although it doesn't have to be, and it must contain the contact information of that particular document.

That could be an author, or it could be an organization, so either of those would work. Okay, so with all that in mind, let's go into our Trails document and see where the address element can help us. So here we're back in our Trails file, and this one you can find in the 05_07 folder. I'm just going to scroll down to our main article because that is the section of the page that I want to pass along some contact information. If I keep going down, all the way down into the footer, I can see that I have a paragraph that says, "About the author: Jeff Layton lives in Ventura, California with his wife," and notice that that also includes his contact data.

So this is the information where devices would pull the contact information of the author for that particular article. So this is perfect for the address element. So what I'm going to do is just change the paragraph element right here to an address element, and I'm going to be sure to do the same thing for the closing paragraph tag as well. Now, I'm going to go ahead and save this. Then I want to test this in a browser, just to see kind of how this is working out for me. So I'm going to preview this in a browser.

As I scroll down, I can see that that is not the way I wanted that to look, and that's not the way that it used to look either. So changing it from a paragraph tag to an address tag has had an adverse affect on my styles, and I find that a lot of times people just forget that they've even used the address tag. They'll use it because they know, okay, semantically I'm supposed to use this. Then they start styling things, and then they just sort of forget that they've used it at all. So you have to pay attention to the usage of tags like the address tag when you're doing your styling. All right! So I'm going to go back into my page, and I want to open up the main.css file.

Now, you can find that file in the 05_07_css directory. So here's my main CSS file, and just to save you a little bit of time, go ahead and scroll down to about line 195, somewhere around in that area. You can see, this is the selector that was driving our text, so section#trailReviews paragraph. Obviously, it's not a paragraph anymore. So what I'm going to do is instead of writing a totally separate selector, I'm just going to group these selectors together. So I'm going to type in a comma, and then I'm going to do section#trailReviews address.

So now I'll save that, go back into my HTML file, and once again test this in my browser. As I scroll down, now that content looks a lot more like I was expecting. So, the address element, it's another element that you might not need to use that often. However, for things like blog posts, articles, or sectional contact information, it allows you to properly identify the contact information pertaining to that content. Remember, now in HTML5, we can have as many of these as we need, but you can only have one per article or per section, so keep that in mind too.

All in all, quite a handy element to have when you need it!

Show transcript

This video is part of

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

46 video lessons · 35812 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.