Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
This course is designed to quickly lead you through the steps of building an HTML website, from creating a new page to building links and tables. Author James Williamson simplifies the coding process, with straightforward steps you can recreate on your own. The course explains the basic structure of an HTML document, shows how to add text and images, and introduces font styling with CSS. James also offers a bonus design challenge at the end of each chapter, where he asks you to think of a solution before offering his own.
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.
There are currently no FAQs about Up and Running with HTML.
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.