Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
In XHTML and HTML Essential Training, Bill Weinman helps designers and coders understand XHTML and HTML. In the process, Bill covers document structure, block and inline-level tags, floating images, controlling white space, phrase and font markup, and tables and frames. He even provides a good introduction to CSS. Bill offers step-by-step guidance for building a complete working web site. Exercise files accompany the course.
Moving right along in building the website, we're doing the gear page now which is the second page in our website and this is what it looks like. So we have a different ID image here. We have this little menu for the different subcategories of gear for sale. We have this paragraph of text and then we have This month's special here, and the content on the right. So, let's get started.
Here in our text editor, we have the empty template. We have the beginning.css, which is where we left off in our last lesson with the CSS, and we have the text that we're going to copy and paste. This is already all XHTML-ified for us. So here we go. First thing we're going to do is we're going to Save As, which is what we always do, and in this case, it's going to be gear.html.
That's the name of the page and then the CSS would be main.css and the gear text we're going to leave alone because we're only reading from that. We're not writing to it. So the first thing we do is we change the page title here and it will be Groundswell Gear. Then we're going to change this menu section here, here only save this, and we'll show you in the browser what we're doing.
Here the Gear menu item is the current image, so it's taller, and it's gray and it's not a link, whereas in the previous page, it was the Home menu item. So here it's the Gear menu item and so we'll need to change that and this is the easy way to do that. I'm just going to grab this here and I'm going to cut with Ctrl+X, that would be Command+X on a Mac, and just move it down one, right to here, so it's between the end of the previous link and the beginning of the next link and press Ctrl+V to paste.
Then I'll change this first one to home, and home here, and home here, and then swap the widths, this will be 80, and this one will be-- was it 73? Yes, 80 there and 73 here and then this home-current becomes gear-current, and this home becomes gear.
So that's how easy that is. I just swap these pieces around and renamed them. So I'll save. We can look at our progress in the browser, gear.html, and drop it in there. There we have the Gear menu. That looks like it works just fine. So if I click on Home, we get the page we did last, but when I click on gear, we get where we are here so far. Now, I want to change this middle image to be the gear ID image.
The Alt text, we'll say check out our gear. Then save that. Now we have our gear banner, hit reload in the browser and there is our gear banner. Now it's time to do the content. First, we'll cut and paste the content from in here and so this is the main part. Just right there, press Ctrl+C to copy, and Ctrl+V to paste.
That's all of that. Let's go ahead and indent it with the rest our content. Go ahead and save and take a look at this. I know it's going to need some CSS work, but that's not bad. So, what are some of the things we need to do here? Well, first of all, we need to format this so that it looks more like that, instead of these default links. So let's start there. All right, so we have a class here for the leftMenu and that will be used for our formatting in the CSS.
So we'll go into the CSS, we'll come down here to the bottom of the mainContent, and we'll go ahead and do a class selector. mainContent is the ID, and then it is p.leftMenu. All right, so first of all, we want this Trebuchet font so we'll go ahead and copy that from some place else. And it's got a margin bottom 1.5ex, and that will give it that space underneath it.
So I'll go ahead and I'll save and we can look in the browser here. So that's that nice space underneath that helps it to look like a menu. Now we need to change these links so they look more like this. See, they don't have the dashes underneath them and they start out with the gray and the highlight as you hover the mouse over them. So I'm going to change that. So that works like this here. Now, we have a three- stage selector to work with.
mainContent, that's the ID selector, p.leftMenu, that's the class selector, and then within that we have the a, for the anchor. So if we look in the XHTML here so that we have mainContent ID selector and then within that the leftMenu class selector, and then within that the tags. So all these tags will be selected by this selector here, this three-stage selector. So what we want do is change the default color to this color here, and then in the hover, we want to take off that border.
So I'm just going to copy this so I have that selector and then edit the hover. Then it will have a different color now. It will be the #b36b00. Again, these colors were all selected for me by the designer. Then border: none and so there we have it. So now when the mouse is hovered over, save, the border won't be there. It'll just change colors.
So let's look at it in the browser here and reload. So now we start with that dingy color, and we get the highlight as we move the mouse over. All right, so that's exactly what it looks like over here. Excellent! Now, we want to format this part here, because that part is not looking how-- so it needs to have all this nice space around and it needs this formatting here, the header, and the body, and then the dollar amount, in this paragraph down there.
So there's quite a bit of formatting to do. So let's get to it now. For this part, we want to just do a separate section. We'll go ahead and put in a comment here, which is the gear description section. The right number of equal signs there. There's a table there I'm going to use to select by. And here it is and it has a td, which is the table cell with an ID gearLeftImage.
So that's just for this image here, and that image is going to float and also has this class, leftFloatImage. In this case, we're really just going to use the td gearLeftImage here and do the formatting from there. All right, so td#gearLeftImage and we are just going to give it padding of 25 pixels all around and I'll go ahead and save.
Then going back over here in the XHTML, we see that the next part is this other table cell that's called gear description. So I'll go ahead and enter a selector for that and that's going to get a width, 290 pixels, save. Let's just take a look at what this looks like in the browser so far. Well, it's starting to get there.
We see that the image looks nicely positioned there and the paragraph looks nicely set up. Now we just need to enter the formatting for this. So we have an h3 for the heading and that's going to get some interesting formatting. It's going to be the Georgia font, font-size will be 1.2em, color is the c47500 color.
It's got a bottom border there and it's got padding at the bottom, just 0.2em. So it's going to be a little close. Then the margin-left, so that its flush is zero. So let's go take a look at that heading now. That heading should now be really pretty. There it is.
So you see in the reference here, it's just like that, and in there, it's just like that. Now let's format the rest of these pieces. Right, so we have this paragraph here, which is going to be in the Trebuchet font, you'll notice in the browser. That's the Trebuchet font. The rest of this is all the Trebuchet font. So we can create a selector just for all the p's in this section and copy and paste that Trebuchet font from up here, and there it is.
The font-size is 0.8em. Save that and get in the browser, we have the Trebuchet font for all the paragraphs. Now, the price paragraph. That has a price selector on it. Go ahead and look in the HTML, you'll see that there's a class=price, so that's a class selector.
We do here is we want to right align it and give it some font size. Make it a little bit larger. So go ahead and save there and look in the browser. There we have the price, all large and to the right. So that makes this whole thing look just like this. See that link in here? It's the style from the rest of the document, and that's just fine.
So that's the left side. Now the right side should be pretty easy. Go ahead and get the text for the right side. I think all this formatting is already ready. I'm just going to copy and come in here. Select these lines and paste. I'll go ahead and select those lines, and indent, and save. You'll not see anything unique in here so that just work just fine and there we have it.
We have product images and they're already all nicely indented everything because of the styles we've applied before. So you can see how this kind of stuff just becomes real easy once you've done it once. This is the power of the style sheets, with all those styles setup for that column. So these elements that are in that column, they just get styled right away, and it all just looks just right. There is our Gear page and it looks exactly like the reference, and the link works, get Home and back to Gear, and there we have it.
On to the next page!
Find answers to the most frequently asked questions about XHTML and HTML Essential Training.
Here are the FAQs that matched your search "":
Sorry, there are no matches for your search ""—to search again, type in another word or phrase and click search.
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.