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

Creating initial page structure

From: CSS: Page Layouts

Video: Creating initial page structure

Now that we've taken a look at our mockup and discussed the initial page structure, it's time to go ahead and start coding it. Although we won't be authoring a lot of code in this exercise, what we'll be writing is extremely important, as it's the foundation for our entire site. Now as such, I'm going to have the mockup here open as we work and discuss what type of impact the decisions we make will have on our eventual layout, so I'll be switching back and forth between those mockup and the code that we create to kind of discuss how they are related. So I've got the mockup_home.ai opened, that we've been looking in the past couple of exercises, but what I'm going to do right now is switch back over to my code editor, and go ahead and crate a brand-new page for us to start working on.

Creating initial page structure

Now that we've taken a look at our mockup and discussed the initial page structure, it's time to go ahead and start coding it. Although we won't be authoring a lot of code in this exercise, what we'll be writing is extremely important, as it's the foundation for our entire site. Now as such, I'm going to have the mockup here open as we work and discuss what type of impact the decisions we make will have on our eventual layout, so I'll be switching back and forth between those mockup and the code that we create to kind of discuss how they are related. So I've got the mockup_home.ai opened, that we've been looking in the past couple of exercises, but what I'm going to do right now is switch back over to my code editor, and go ahead and crate a brand-new page for us to start working on.

So I'm just going to go up to File and choose New, I'm just going to do a new file. If you're not using Aptana, just whatever code editor you're using, go ahead and create a new file. Now I'm going to place this file in the Chapter 2, 02_05 folder. So I'm just going to save it right in there, and I'm going to name it index.htm. Okay, so there is our new file. Now the first thing I'm going to do is just go ahead and code the initial page structure. I am going to start off with a doctype declaration, and I'm just going to do doctype html.

You know, doctype are not case sensitive, so if you want to use a lower case here, that's fine. It doesn't really matter, just the exclamation point, DOCTYPE, and then html. Now you may be used to seeing a much longer doctype for older versions of HTML or even XHTML, but with new HTML5 doctype, we basically have the doctype there to trigger standards mode and just identify this as an HTML document. It really doesn't need to do anything besides that. Now on the line below that I'm going to go ahead and create an HTML tag, and I'm going to give myself a little bit spacing there.

Inside the HTML tag the first thing I'm going to do is create a , and inside the head, I'm going to go ahead and create a metatag with a character set attribute, so charset, and I'm going to make that value equal to "UTF-8," and I'll close that now. I don't need to self-close that because I'm doing HTML5. So the syntax is a little different. I don't need a closing tag. All that's really doing for us is insuring that the property character encoding is going to happen for our page. Okay, on the next line, I'm just going to go ahead and do a title, and inside the title, I'm going to type in "Welcome to Desolve." And then after the head I'm going to go ahead and create my body tag.

I will give myself a little bit space between that. Awesome! Okay, I'm going to go ahead and save that. All right. So that's really just getting the base structure out of the way. We haven't really started structuring any of our page content yet, and we'll do that within the body, so this is just a very minimal HTML page that's going to give us our basic starting point. All right, so as we went back through and identified regions in our mockup earlier, remember, the first region is going to be our header. So I am going to go back into my code. We're going to start with div tags for our structure, but later on we'll go back and revise these with HTML5 tags, once we start talking a little bit more about semantics.

So inside of this div tag I'm going to type in "Header content goes here," just so that we know kind of what belongs in that particular region, and I'm going to save the file. Now as I start building this, I'm going to start thinking a little bit about also the CSS that's going to be driving the layout. And if we start looking at these regions, we can see that the header region and the navigation and the banner, those all stack right one on top of another, but then down below that we have this article and our sidebar that sits side by side, and then we have finally a footer at the very bottom of the page.

So we can see the normal document flow is going to account for most of this layout, but when we get to this point, we're going to need to define some type of mechanism within our layout to move this column to left-hand side and that column to the right-hand side. Okay, so I'm just going to keep structuring my code. The next step is going to be our nav element, and then that's going to be followed by banner. So in my code I'm going to come in and create a brand-new div tag. And this time inside the tag, I'm going to type in "Navigation goes here." I have another div tag below that, and for this one I'm going to type in, "Banner content goes here." Now below the banner, remember, we have our article and our sidebar. Even though those two elements are sitting side by side in our layout, structurally I have to figure out which one of these I want to come first within my content. And this is a very important decision because screen readers or other type of user agents are going to experience that content in a different way than somebody who's just say looking at it within the browser.

So you really have to make a decision about which content is more important or which content should precede the other. In this case, I really want the article to come first and then the sidebar to come second, because the article is a little bit more important, and that content needs to be accessed. So I am going to go back into my code, I'll create another div tag, and here I'm just going to type in "Article content goes here," and then below that we'll do another div tag and we'll say "Sidebar goes here." Okay, now the only other element left on our page of course is this footer, so I'm going to go ahead and code the footer as well, and again just another div tag, and we're just going to say "Footer content goes here." Now it really wasn't that long ago, probably only two or three years ago, that I would begin structuring my page exactly like this, with this many divs.

Now, with the advent of HTML5, and I have some more structurally or semantically, I should say, sound elements to use, and we're going to switch over to using some of those just a little bit. But I really want you just to understand how the content is being grouped, in terms of the structure of the page, before we talk too much about semantics. Now there are other decisions that you're going to make at this point. Even though this is the basic structure, you might say to yourself, okay, are there other ways that we might group and arrange this content? Header, you know, sort of by itself, Navigation, I can see that being by itself. These two items, the Article and the Sidebar, those two items definitely relate to each other in a very significant way.

And in most pages we're not going to have this banner content, but in the homepage at least, I can see the banner content also being related to those two elements as well. So on the secondary pages, even though the banner isn't going to be there, I think it's still part of this main content on the page. And so, because of that, what I'm going to do is I'm going to wrap those three elements inside another div tag. So what I'm going to do is I'm just going to go above that banner and create another sort of generic div tag, and then just above the footer, I'll close it.

So these three elements are going to be grouped inside of another div tag. And a lot of times when you're authoring a page, you need to make this kind of judgments, thinking about how that's going to affect the entire site. Does this grouping make sense for my secondary pages, is this something that's going to allow me some flexibility a little bit later on, and how does that impact the layout? How does grouping those elements together, is it going to make it more difficult to display this as a two-column layout? So those are all things you need to think about. Okay, so that completes the basic structure of our page. Now as you can tell, it's really nondescriptive. I mean without the text inside those div tags, we wouldn't know what was supposed to go inside of them.

So because of that, the page really, at this point, isn't making any sense, semantically, at all. So next, we'll explore how we can add a little bit more meaning to our content through IDs and classes, and then we'll continue to move on to learning more about HTML5's semantic elements.

Show transcript

This video is part of

Image for CSS: Page Layouts
CSS: Page Layouts

71 video lessons · 40774 viewers

James Williamson
Author

 
Expand all | Collapse all
  1. 4m 20s
    1. Welcome
      54s
    2. How to use the exercise files
      3m 26s
  2. 1h 39m
    1. Box model review
      8m 47s
    2. Calculating element dimensions
      11m 11s
    3. Understanding margin collapse
      7m 59s
    4. Calculating em values
      7m 41s
    5. Calculating percentage values
      7m 51s
    6. Normal document flow
      13m 3s
    7. Controlling element display
      8m 53s
    8. Using CSS Resets
      7m 11s
    9. Fixed, fluid, and responsive layouts
      9m 9s
    10. CSS debugging tools
      6m 46s
    11. Using the Firebug Inspector and the WebKit Web Inspector
      11m 5s
  3. 53m 15s
    1. Page design workflow
      3m 6s
    2. Page design tools
      4m 56s
    3. Determining page structure
      7m 18s
    4. Creating image assets
      8m 58s
    5. Creating initial page structure
      7m 3s
    6. Adding meaning with classes and IDs
      5m 23s
    7. Structuring content with HTML5
      6m 6s
    8. Building internal structure
      10m 25s
  4. 1h 36m
    1. Floating elements
      7m 50s
    2. Clearing floats
      7m 28s
    3. Containing floats
      7m 50s
    4. Clearfix technique
      10m 38s
    5. Floating inline elements
      14m 34s
    6. Two-column floated layouts
      8m 17s
    7. Three-column floated layouts
      11m 30s
    8. Column height considerations
      7m 3s
    9. Creating equal-height columns
      10m 42s
    10. Floats: Lab
      5m 25s
    11. Floats: Solution
      5m 21s
  5. 51m 42s
    1. Relative positioning
      7m 59s
    2. Absolute positioning
      8m 59s
    3. Fixed positioning
      4m 23s
    4. Controlling stacking order
      8m 31s
    5. Clipping content
      8m 21s
    6. Controlling content overflow
      5m 38s
    7. Positioning elements: Lab
      3m 59s
    8. Positioning elements: Solution
      3m 52s
  6. 48m 46s
    1. Design considerations for fixed layouts
      3m 28s
    2. Establishing the layout grid
      7m 57s
    3. Defining column spacing
      9m 30s
    4. Applying the grid through CSS
      8m 56s
    5. Creating grid-based assets
      8m 26s
    6. Grid design resources
      6m 22s
    7. Building fixed layouts: Lab
      4m 7s
  7. 44m 35s
    1. Designing for flexible layouts
      2m 30s
    2. Calculating percentage values
      8m 45s
    3. Setting flexible width values
      6m 6s
    4. Making images flexible
      8m 10s
    5. Setting minimum and maximum widths
      7m 24s
    6. Building flexible layouts: Lab
      4m 53s
    7. Building flexible layouts: Solution
      6m 47s
  8. 49m 36s
    1. Responsive layout overview
      3m 49s
    2. Using media queries
      7m 16s
    3. Organizing styles
      8m 39s
    4. Making content responsive
      8m 33s
    5. Mobile design considerations
      7m 32s
    6. Building responsive layouts: Lab
      4m 23s
    7. Building responsive layouts: Solution
      9m 24s
  9. 1h 22m
    1. Creating multi-column text
      6m 36s
    2. Using borders to enhance design
      13m 59s
    3. Rounding corners
      6m 56s
    4. Adding drop shadows
      10m 35s
    5. Working with opacity
      6m 8s
    6. Utilizing the background property
      15m 5s
    7. Working with CSS sprites
      7m 58s
    8. Enhancing page design: Lab
      6m 22s
    9. Enhancing page design: Solution
      8m 38s
  10. 6m 25s
    1. Additional resources
      6m 25s

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 CSS: Page Layouts.

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.