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

Solution: Controlling page content

From: Up and Running with HTML

Video: Solution: Controlling page content

I hope you had a good time with the controlling page content lab. Now, if you are finished or if you're just stuck on a proportion of the lab, let's compare your code to the finished files. I've got the lab_instructions file open from our previous lab, but I also have the finished files from the finished_files directory inside the 03_10 directory. The first thing that we were tasked to do is determine a header strategy, and an easy way to determine how I handle the headings on the page is just to go through all the pages and take a look at all of the headings.

Solution: Controlling page content

I hope you had a good time with the controlling page content lab. Now, if you are finished or if you're just stuck on a proportion of the lab, let's compare your code to the finished files. I've got the lab_instructions file open from our previous lab, but I also have the finished files from the finished_files directory inside the 03_10 directory. The first thing that we were tasked to do is determine a header strategy, and an easy way to determine how I handle the headings on the page is just to go through all the pages and take a look at all of the headings.

You are going to notice some consistency. Up here in the header, I have a heading 1, an h1, surrounding the Up and Running with HTML, which is the title of the course or the site if you will, and then an h2 just below that that indicates the current page, in this case Introduction to HTML. That's consistent on every single one of these pages. Essentially, I developed a strategy that said an h1 is going to identify the site and then the h2 is going to identify basically the current page. I isolated it and only used an h1 and h2 in the header. I didn't use heading 1s and heading 2s anywhere else within the site.

You may have decided, for example, that the headers directly underneath the header section maybe were just as important as the title of the page. But I felt that those two sort of occupied a very special part within the TOC or within the document outline that I am creating, so I made those two sort of the top-level headers for each page. Now what that means is that every other header on the page below that is either an h3 or an h4 based upon a level that it's at. And if you go through all the pages, you'll see that.

For example, on the Links pages, we have h3s for some of the different link types. But if you scroll down, you can see that we do have some heading 4s. It's kind of hard to visualize this when you're looking at text, so if I preview this in the browser, you can see what I'm talking about. We have a section here for Link syntax and Link types. Well, within the Link types section, I am discussing three different types of links. Rather than having these headings be at same level, this got to be an h3 and then these were h4s because they were a little below that.

Now, nowhere in the site do I go below an h4. That doesn't mean that if you did your headings a little bit differently than mine that you're wrong; you just have a different strategy than mine. What you want to focus on though is are you consistent with the way that you're using the headings on every single page--did you do it the same everywhere?--and are they progressing in a logical order, meaning h1, h2, h3, h4, and so forth and so on. And make sure that you don't have a heading 4 in one instance and a heading 3 in the other and those two really be just as important as the other. So those are things that you want to be very, very careful about doing.

The next instruction was formatting the paragraphs in the intro. I think probably everybody was able to do that okay. The only thing that you may have had trouble with was determining what was a header and was a paragraph. So just go ahead and go through the finished code, take a look at all the different paragraphs that are on the page, and all the headers, and make sure that your code matches up with mine as far as those paragraphs go. Now, in terms of the lists themselves, here we actually may have had some disagreement. In the intro, if I go down to the timeline, you are going to notice that I use an ordered list.

Now, this ordered list is actually going to result--and I am just going to go navigate to this page--in a 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, and 12. Now, it looks a little awkward, but remember, we are looking for the semantic or the structural reason to use a list type over another. Remember what I talked about in terms of deciding between an ordered and an unordered list. If you can reorder everything and it doesn't change the meaning of list, that's an unordered list. But think about this timeline. If I suddenly just shuffled all these different years around, well, that changes things, and it would make the timeline harder to understand.

So in that case, we definitely do need an ordered list here. Now one of the things I could do using CSS is if I found those numbers to the side distracting, I could use CSS and tell the browser not to display them. In the terms of how it should be formatted logically, I thought an ordered list made the best choice here. Now, the next thing we were supposed to do, in terms of list, were controlling the nesting of the lists over in the next.htm. So if I go over to next and I scroll down, what we were looking for are these HTML specifications.

Remember, to properly nest a list, you do it inside the list item that they belong to. Just after this list item for HTML specifications, before the list item closes, I put in this brand-new unordered list that has all of those different elements about the HTML specifications. Then, and only then, do I close out that list item and the resulting page-- I am going to navigate to that and scroll down--gives us this formatting where these elements are nested inside the category HTML specifications.

The last thing that I asked you guys to do was to go to the reference page-- I am just going navigate to that--and determine what type of list we should use for the glossary of terms that we have here. I'm betting that most of you chose to do a definition list, and the reason is because of the way that this is set up. We have a term, and that's immediately followed by a description of that term, or definition if you will. That's absolutely appropriate for a definition list.

If you used an ordered list or an unordered list, it probably wouldn't be the right list to use here, because there's a special relationship between these two elements within the list, and list item really doesn't denote any type of a special relationship other than the fact that they belong group together. The definition list allows us to say that not only is all of this content related to each other, but these two are related in a very special way; in fact, this one is a term and this one is a description or a definition of that. So I used a definition list there.

When we talked about determining emphasis, we were going to go to next and format some of these elements. Again, let me show you, visually, what we were doing here. We were focusing on this top-level area. Now, here's where your code and my code might really dramatically diverge, because I didn't give you really concrete instructions here. I just wanted to see how you would approach this on your own. And if you are sitting here, "thinking, oh my code doesn't match his, or it doesn't look like his; it's wrong," that's not necessarily true. If your code achieves what I asked, which was strongly emphasize the first line in the paragraph and isolate it in a way that really emphasizes the importance of that, then you have done it correctly, and you may have decided for example to put that inside of a heading 4.

That would have been okay. But here's how I formatted that. If I go into next and I scroll to that area, you can see that each one of these is located in a strong tag--again, strongly emphasizing that text. It could be styled any way that I want. I am letting the browser render it in bold, but I could style it differently if I wanted to, and then I use a line break to force the rest of the paragraph down on another line. So in the end, this is all still one big paragraph, and this line is being strongly emphasized.

And sometimes there is a real fine line in between what is the header and what is text that is being just emphasized or strong text or a category. Sometimes a header is going to make sense; sometimes it doesn't. In this case, you could kind of go either way with it. So if your code doesn't necessary match mine, that's okay. There is nothing really wrong with that. Now, in the last paragraph, down here towards the bottom of the page, I asked you guys to italicize these two quotes, "what would happen if I?..." and "wonder if I could build" and then I ask you to make sure that this text "always challenge yourselves" is emphasized.

Now you'll see in this case, the browser is rendering all three of them the same, but I wanted there to be some logically differences between those two sections. So if I go back into my code and scroll down into this, you can see that I am using the italics tag right here for the first quote and I am using the italics tag again for the second quote. Finally, for the emphasized text, I am using the em tag and again, that's all about the logical choice that I was asking you guys to make there. Below that I asked you to bold all of the head category terms for list, so you'll notice that each one of these is wrapped in a bold tag, not a strong tag, because again, all I wanted to do was format it bold, not necessarily strongly emphasize it or have any type of logical connotation there.

Next, we talked about displaying special characters. If I go to the reference page and I look down here in this table down here at the bottom, you'll see all of those named-character entities right there in the appropriate table cell. If we go into the browser and we take a look at those--let me scroll all the way down-- you can see that now the actual characters themselves are displaying, giving people an idea of what those characters look like. I also talked about going up into the glossary and right here for elements, wrapping the word tags in quotation marks, but instead of just using the regular pipe characters, I wanted the left quote and the right quote to be used appropriately.

So if we go into the code and we scroll up into those elements, you can see, right there, there is our left quote and our right quote wrapping tags. So you just want to make sure that you did that exactly the same way. Finally, on the intro page we needed to place an image on the page and if I go to intro, scroll to the appropriate paragraph, you can see, right there, there is your image tag. For the most part your code should look the same. If your attributes aren't exactly in the same order as mine it does not matter. What does matter, however, is that you resolve the path properly, so it should point to _images/ and then the name of the image.

You should use the alt text "W3C logo," pass in the width and height. Of course that's optional if you left them off, because we are not changing those, and then for the class, make sure that flowLeft was applied. The end result of that, if you did it properly, if we go to our intro page, you should see this on the page. Now, if it's not rendering properly or if the dimensions of it don't look right or if it looks stretched or you're seeing alt text there instead, go back in and take a look at your attributes and make sure that everything matches kind of what you see here.

I know there was a long lab, but there was definitely a reason behind doing everything here. Keep in mind that in many instances how you format page content will be a personal decision that depends upon your point of view, which may differ from mine or other web designers, and there is nothing wrong with that. Just make sure that you thoroughly understand the rules surrounding the use of these formatting elements so that your decisions are based on the proper usage of those tags.

Show transcript

This video is part of

Image for Up and Running with HTML
Up and Running with HTML

49 video lessons · 26864 viewers

James Williamson
Author

 
Expand all | Collapse all
  1. 2m 12s
    1. Welcome
      55s
    2. Using the exercise files
      1m 17s
  2. 29m 30s
    1. Learning HTML
      2m 47s
    2. Choosing a code editor
      5m 2s
    3. Exploring basic HTML syntax
      8m 18s
    4. Do I need to learn HTML5?
      5m 6s
    5. Exploring HTML references
      8m 17s
  3. 35m 40s
    1. Exploring an HTML document
      5m 19s
    2. Working with doctype declarations
      4m 3s
    3. Examining the document head
      8m 20s
    4. Looking at the document body
      3m 21s
    5. Adding document structure
      8m 52s
    6. Lab: Coding a basic page
      3m 9s
    7. Solution: Coding a basic page
      2m 36s
  4. 1h 23m
    1. How does HTML format text?
      5m 51s
    2. Adding headings
      7m 24s
    3. Formatting paragraphs
      4m 54s
    4. Controlling line breaks
      3m 50s
    5. Creating lists
      10m 37s
    6. Emphasizing text
      6m 42s
    7. Displaying special characters
      5m 8s
    8. Controlling whitespace
      4m 35s
    9. Inserting images
      9m 20s
    10. Lab: Controlling page content
      13m 57s
    11. Solution: Controlling page content
      10m 55s
  5. 31m 54s
    1. Linking to pages within your site
      6m 45s
    2. Linking to external pages
      3m 2s
    3. Linking to downloadable resources
      2m 25s
    4. Linking to page regions
      8m 0s
    5. Lab: Creating Links
      5m 57s
    6. Solution: Creating Links
      5m 45s
  6. 40m 27s
    1. Examining basic table structure
      5m 10s
    2. Adding content to tables
      6m 20s
    3. Setting table attributes
      7m 42s
    4. Adding table captions
      4m 3s
    5. Defining table headers
      2m 13s
    6. Making table data accessible
      5m 46s
    7. Lab: Building tables
      4m 13s
    8. Solution: Building tables
      5m 0s
  7. 43m 23s
    1. Understanding the relationship between HTML and CSS
      4m 58s
    2. Creating inline styles
      4m 53s
    3. Exploring the style element
      5m 13s
    4. Basic font styling
      9m 24s
    5. Changing color
      4m 55s
    6. Taking styles further
      5m 24s
    7. Lab: Controlling basic styles
      5m 10s
    8. Solution: Controlling basic styles
      3m 26s
  8. 5m 44s
    1. Next steps
      2m 56s
    2. Additional resources
      2m 48s

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 Up and Running with HTML.

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.