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

Building a main home page: sidebar content

From: XHTML and HTML Essential Training

Video: Building a main home page: sidebar content

As we continue building the example website, in our last lesson, we filled in the left-hand side of the main homepage and in this lesson, we'll continue with the Sidebar Content. So, let's get started. Here in our editor we have our beginning.html, which has the content for the left-hand side that we filled in last time. And our beginning.css, which likewise has all of that style from the last time. And our home.txt which has the content here for the sidebar, which we'll be copying, and first let's go ahead and do our traditional Save As and saving as home.html, because this will be the homepage.

Building a main home page: sidebar content

As we continue building the example website, in our last lesson, we filled in the left-hand side of the main homepage and in this lesson, we'll continue with the Sidebar Content. So, let's get started. Here in our editor we have our beginning.html, which has the content for the left-hand side that we filled in last time. And our beginning.css, which likewise has all of that style from the last time. And our home.txt which has the content here for the sidebar, which we'll be copying, and first let's go ahead and do our traditional Save As and saving as home.html, because this will be the homepage.

And save the css as main.css and our home.txt, we don't have to Save As because we're only going to be reading from it not writing to it. Let's go ahead and copy this content, so I'm pressing Ctrl+C because I'm using a PC here. If I were using a Mac, I would use Command+C and over here in our home.html, we're going to scroll down to the Sidebar Content and go ahead and press Ctrl+V to paste and there we have it.

So, the first thing I want to do is fill in the XHTML here, and like I said before for the home page, we're doing all of these manually in the future pages because we'll have had this experience. We're going go ahead and just cut and paste the already HTML-ified or Xhtml-ified text. So, I'm going to start with this image here and let's say img src= and there I have that and then I'm going to go to fill in the width and height. I'll go ahead here and drag this over because this Editor is kind of cool. It allows me to do it this way. Here we go.

So that's our image tag and then this gets an h3, because we use h3 for the right-hand side for the sidebar and we get paragraphs here and then paragraph here and then we have another image. I can just cut/paste. That's the other way to do this. Now, this is an h3. And add another image.

Drag that over. That's just fun to do it that way. And there we go. Another h3, another paragraph and an end paragraph. And then we have some links here. This is supposed to be a capital C there. I make that a href = and end a, equal to that part and take this part here and stick it in there and the same thing here.

And finally, this one here. Now, one other detail. These images are in the images directory, so we'll just say images here and I'll copy that and paste it here and paste it here, there we go. I think our content is ready and I'll go ahead and take all of this and indent it. In this editor here, which is Notepad++, I select a block of text and use the Tab key.

Different editors have different ways of indenting. I find it very valuable to keep my code indented. It helps me to find my way around and to know what is related to what. So we'll go ahead and save this. Now there is some formatting we're still going to need to do in css. But let's just take a peek and see what it looks like in the browser real quick. And we'll need to drag in this file, which is the home file in our home-part2. Drag this into the browser and there we have it, there is our right content. So that's great! It looks good.

It's still not entirely done. We need to format these images over. If we look at our example here we see that it's very close. The images are indented a little bit and the one's that our photographs have this nice little border on them. So we'll go ahead and do that in the css right now and that's over here in our css and we're going to add a couple of styles down here in the sidebar section right over here. All right, so the first thing we want to do is we want to indent those images a little bit and so we can do this here.

So this would be the selector for the images in the sidebar because they are under the contentRight, content margin 0 25 pixels. So, this makes the top margin and the bottom margin 0 and the left and right margins 25 pixels, and I'll just go over to the browser and take a look at that. Save here and reload and there we have it. Our images are now indented. Now, all we need to do is to put a border on these photographic images.

We go back into the XHTML and we use a class selector here. For the ones that are photographs, so this Surf1 image of photograph, this is a product image. So this is a photograph, so put in a class selector here. Now we go and put that class in the style sheet. So we're using a combination of selectors here now. This is something we haven't done before.

So, we have the ID Selector for the contentRight ID and so all of the images that are within that context that also have this class selector. So, img.photo is a class selector. Those who'll get this additional style and first they will apply this image style and then they will apply the class selector because that's where they are in the hierarchy. It's not because one is after the other in the css file. It's because hierarchically, img gets applied before the class img.photo.

We're applying a padding of 5 pixels. Remember padding goes inside of the content box and it expands the content box. And the border is a 1 pixel border, which also expands the content box by 1 pixel. It will happen on the outside of the padding because the padding is inside of the content box, like margin is outside. So, we'll go ahead and save this and we would expect this to create 5 pixel padding with a dark border around. It's not quite black here. It's a gray border.

Go ahead and reload in the browser and there we have it. So these boxes got a little bigger, you saw that and now there is this 5 pixel border around it. That's the padding because it's not margin. Margin would be on the outside of the border. It's on the inside, so that's the padding and that only happened on the ones that we gave that class selector to the photographs, so there we have it. We are done with the homepage. We have now created the main content and the sidebar content for the home page, and so we'll go ahead and move on to the next page.

Show transcript

This video is part of

Image for XHTML and HTML Essential Training
XHTML and HTML Essential Training

59 video lessons · 80305 viewers

Bill Weinman
Author

 
Expand all | Collapse all
  1. 5m 10s
    1. Welcome
      1m 16s
    2. Using the exercise files
      1m 23s
    3. Choosing a text editor
      2m 31s
  2. 15m 46s
    1. Introducing HTML and XHTML
      2m 53s
    2. Understanding versions of HTML and XHTML
      2m 25s
    3. Exploring a simple XHTML page
      4m 47s
    4. Understanding the structure of an XHTML document
      2m 58s
    5. Understanding document containers
      54s
    6. Creating and using templates
      1m 49s
  3. 42m 4s
    1. Understanding how empty space is formatted in XHTML
      2m 42s
    2. Using paragraph tags
      2m 42s
    3. Aligning paragraphs
      2m 49s
    4. Understanding block-level and inline tags
      1m 24s
    5. Controlling line breaks and spaces
      5m 43s
    6. Formatting text with phrase element tags
      3m 28s
    7. Formatting text with font markup elements
      3m 24s
    8. Adding document structure with headings
      3m 25s
    9. Formatting quotations and quote marks
      2m 19s
    10. Preserving pre-formatted text
      1m 30s
    11. Selecting a typeface
      4m 33s
    12. Selecting a type size
      2m 11s
    13. Using ordered and unordered lists
      5m 54s
  4. 7m 48s
    1. Using inline images
      3m 17s
    2. Flowing text around an image
      2m 4s
    3. Breaking lines around an image
      2m 27s
  5. 22m 34s
    1. Working with hyperlinks
      7m 46s
    2. Using relative URLs
      3m 5s
    3. Specifying a base URL
      2m 4s
    4. Linking within a page using fragments
      4m 28s
    5. Creating image links
      5m 11s
  6. 22m 56s
    1. Introducing tables
      4m 37s
    2. Formatting tables with CSS
      8m 50s
    3. Aligning images with tables
      5m 7s
    4. Reviewing an alternative solution using CSS
      4m 22s
  7. 14m 31s
    1. Introducing frames
      7m 56s
    2. Hiding frame borders
      3m 15s
    3. Creating inline frames using iFrame
      3m 20s
  8. 20m 50s
    1. Introducing forms: part 1
      10m 37s
    2. Introducing forms: part 2
      7m 45s
    3. Using CGI with forms
      2m 28s
  9. 25m 42s
    1. Introducing CSS
      3m 11s
    2. Understanding levels of inheritance
      6m 10s
    3. Learning CSS syntax
      11m 23s
    4. Using units of measure in CSS
      4m 58s
  10. 1h 45m
    1. Comparing table layout and CSS layout
      1m 25s
    2. Exploring the finished web site
      2m 37s
    3. Building a document header
      8m 18s
    4. Placing a banner and a contact button
      8m 13s
    5. Laying out a main menu
      6m 55s
    6. Creating a layout template: main body area
      13m 31s
    7. Creating a layout template: sidebar area
      5m 17s
    8. Creating a layout template: footer content
      4m 46s
    9. Building a main home page: main body content
      11m 24s
    10. Building a main home page: sidebar content
      8m 52s
    11. Creating a page with a menu, graphics, and formatted links
      13m 26s
    12. Creating a page containing an ordered list
      6m 44s
    13. Creating a page containing video
      10m 45s
    14. Touring the finished site
      3m 45s
  11. 53s
    1. Goodbye
      53s

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 XHTML and HTML Essential Training.

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.