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

Creating a two-column layout

From: Dreamweaver CS5 Essential Training

Video: Creating a two-column layout

Our Explore California layout is almost finished. Now we need to create the two-column layout using our main content, main navigation and sidebar. Remember that the main navigation and sidebar need to look like they are part of the same column, even though they are separated by the main content region. We will achieve this by floating the main content right and the sidebar in the main navigation to the left. We will also have to take special care to make sure that the sidebar and the main navigation areas never overlap or appear inside each other. We'll do this as well as assuring that the footer is going to remain in place by clearing our floats as well.

Creating a two-column layout

Our Explore California layout is almost finished. Now we need to create the two-column layout using our main content, main navigation and sidebar. Remember that the main navigation and sidebar need to look like they are part of the same column, even though they are separated by the main content region. We will achieve this by floating the main content right and the sidebar in the main navigation to the left. We will also have to take special care to make sure that the sidebar and the main navigation areas never overlap or appear inside each other. We'll do this as well as assuring that the footer is going to remain in place by clearing our floats as well.

So I have the index file open and you can see we're sort of picking up where we left off. We still have some placeholder content here and there. So if you want to get rid of that "Content for ID header goes here" text, you can do that, because that doesn't need to be there anymore and now we need to concentrate on our mainNav, mainContent and sidebar. Now, we can see because of the fact that our Explore California header logo is being absolutely positioned, everything else is just moved up to occupy the space that it used to be in, and the first element, which is the blue one right here, is our main navigation and that is the first one that we're going to go ahead and start laying out using our floats.

So I'm going to go over to the CSS Styles panel, I'm going to double click mainNav and I'm just going to take care of a couple of properties here. We are going to go to the Box property. For float, I'm going to float it to the left, the width at 272 is fine, and I'm actually going to leave the height too. The reason I'm leaving the height is because I just want to show you some volume. Again, and you're actual layout, you would let the content form the height there. You wouldn't have that explicit value. So if you ever going to take this layout and kind of do something with this on your own and you want to experiment with it a little bit, be sure to remove the height value so that whatever you place in your navigation will take care of the heights for you.

And then the next thing we need to do is take care of the fact that the absolute positioned logo is removed from document flow. So there is nothing this is going to take our mainNav area and push it down. So we've got to allow for that. So what we're going to do now is still on the Box category we are going to deselect Same for all for margin and we're going to give this a top margin of 233 pixels. When I click OK, I can see that has pushed our mainNav area down and it leaves us about 20 pixels worth of space between the logo and the mainNav and that's caused by all this margin right up here. Perfect! Now let's go to our mainContent region and position it on the right-hand side of our page.

So let's go over to our CSS Styles, find the mainContent ID selector, and double click that. So here we are going to go to the Box category as well and we want to float this to the right. So we are going to float that against the right edge of the page instead of the left. We are going to leave the width at 608 pixels and we are actually going to leave the height at 600 as well. Again, we are just going to leave that height in there so that there's some volume to this. If we didn't, it would just collapse but in a real page layout you would place content inside there and that would form the height for you.

Now we are going to do a couple of things with margins and padding. So I'm going to deselect Same for all for padding and I'm going to give it a right padding of 25 pixels. What that's going to do for us is it's just going to hold off anything that's in the mainContent 25 pixels away from the edge of the wrapper. It's going to give us a nice little gutter or a margin if you will on the right-hand side. So why aren't we using margin? It's a personal choice. We could use margin there, but there is a bit of a problem with that. In older versions of Internet Explorer, if you float an element to one side and then also give it a margin on that side, you trigger a bug. Notice the doubled float margin bug.

In that case, we end up with twice the value of the margin we want and it's going to look terrible in that browser. By using padding here instead of a margin, we're avoiding that bug altogether. Finally, let's go to our margin and I'm going to deselect Same for all and do a bottom margin of 45 pixels. That means that any content underneath the mainContent such as the footer is going to continue to be pushed down by about 45 pixels of extra space. That's going to ensure that any content you place inside the mainContent won't end up right against the edge of the footer or any other element underneath it.

I'm going to go ahead and click OK and now our mainContent shows up exactly where we want it, and notice that it has its margin right down there at the bottom. Okay, well our mainNav is being positioned there but because the mainNav and the mainContent have both been floated, the sidebar, which is this green area, is now coming right up under everybody else. So now we need to go ahead and make sure that our sidebar becomes part of our two columns layout as well. So, I'll go over to my CSS Styles, find the sidebar, double-click that and now I'm going to go back down to our Box categories. We are going to float that to the left and we're going to leave the width at 272 pixels and I'll just leave the height at 300 pixels, again just to give it some volume.

Now we are going to do one thing a little bit differently here on the sidebar. In addition to floating the sidebar to the left, we are also going to clear it to the left. Hmmm, now why are we doing that? Well, remember, we don't want the main navigation and the sidebar to ever show up beside each other. It would break our two-column layout and it would make it look like a three-column layout. Well, normally that wouldn't happen just because we will probably have enough main content to keep that always sort of on the left-hand side. What happens if you're dealing with the page that doesn't have a lot of content in it and you have got a long sidebar and a long main navigation area? Well, what happens is if the mainContent region went out far enough, the sidebar will try to allow the main navigation to float to its left.

By telling the sidebar to clear to the left, you are basically telling it, "hey, don't ever let anybody float to the left of you" and that's going to keep it below the main navigation and then give them the appearance of big stack, one on top of the other. So we are going to go ahead and click OK there and now if I scroll down, I can see the sidebar and those guys were stacking one on top of each other and if it wasn't for their separate background colors, they would look as if they were in one single column. Perfect! Now our footer is the last thing we need to do and currently the footer is just coming right on up underneath everybody else, because these guys have all been removed from normal document flow.

So I'm going to double-click the footer, and we are going to go ahead and put in some properties for our footer here. Now we are going to put in more than you think probably because we're going to go ahead and put in the background graphic for the footer as well. I'm going to go to our Box category and the first thing that we are going to do is we are going to clear both. That way the main content that's floating on the right and the sidebar and the main navigation floating on the left will not effect the footer. The footer is going to remain below them. We are basically reestablishing normal document flow. Now, here is where things are going to get a little tricky.

It would be really easy to go ahead and leave the width of this at 930 pixels, but I want to give you guys a realistic example of some of the things that you have to deal with when you're dealing with CSS-based layouts. Eventually, our footer is going to have three columns of text in it. It's going to be quite an involved footer. And so because of that, we need to go ahead and allow for the fact that we don't want the content inside of it to butt right up against the edges. So what I'm going to do is deselect Same for all for padding. I'm going to go ahead and give it a top padding of 45 pixels, a right padding of 30 pixels, a bottom padding of 30 pixels and a left padding of 30 pixels.

Now because of the fact that we're adding 30 pixels to the left and 30 pixels to the right, we're adding an additional 60 pixels worth of width to our footer. So in order to make sure that it's not actually wider than the wrapper itself, we're going to change the width of the footer to 870 pixels. Now you might be asking, well, why do we have to define the width at all? If it's a block level element won't it expand if it's a parent container? Now you're right, it will. But we want to show a background image, and that background image has a defined width and a defined height.

I want to ensure that this is going to be large enough to display that. Speaking of that, we're going to change the height to 525 pixels. So it's going to have a width of 870, a height of 525. Padding is going to be top 45 and then right, bottom and left will have 30 pixels worth of padding. We are also going to go ahead and add a top margin of 45 pixels on that as well to increase the amount of space above the footer. So everything is looking pretty good. Last thing we need to do here is go ahead and grab the background image for our footer.

So I'm going to go to the Background category, I'm going to get rid of the background color that we have here, and I'm just going to browse for our background image. And once you're in the 10_09 images directory, you want to browse down and find this image right here, footer_back.gif. Notice it is 930 pixels wide by 600 pixels tall. So map of California, it's got some dark blue here where we can place some text on it, and then the tan color right here is going to do a nice job of blending that in with the background. We could've done that by using a PNG and having alpha transparency but really that's a really simple thing to do.

So involving transparency in something is as simple as that is probably unnecessary. I am going to go ahead and click OK. We only want to see it once. So for background-repeat, it's going to be no-repeat. Click OK again and there is my footer. If I save, if I do a Save All, and preview that in my browser, we can see the very beginnings of our layout. There is our footer, there is our sidebar, our main content region, and our main navigation. Once enough content gets in there to stretch that out, it's going to make the layout blend seamlessly into the background instead of what it's doing here and we are going to be in really, really good shape.

So the only thing our layout needs right now is content placed into the individual regions and then that interior content styled. Now, I know this doesn't look that impressive, but for the most part main page layout is done. The major page regions are laid out according to our overall strategy and one thing I want to point out that I haven't talked about yet. Notice that we've separated the layout styles from the styles that we will follow that are going to control typography and any sort of inner region areas. This strategy allows us to quickly tweak the main page layout and then quickly find and eliminate any cross browser issues or style overrides as we're constructing the rest of our page.

Of course, the more you add to the page, the more complicated things become. So in our next series of movies, we are going to explore some of the Dreamweaver tools that you can use to troubleshoot layout issues and refine your styles.

Show transcript

This video is part of

Image for Dreamweaver CS5 Essential Training
Dreamweaver CS5 Essential Training

135 video lessons · 89038 viewers

James Williamson
Author

 
Expand all | Collapse all
  1. 2m 57s
    1. Welcome
      1m 8s
    2. Using the exercise files
      1m 49s
  2. 7m 50s
    1. What is Dreamweaver?
      3m 16s
    2. Learning web design
      2m 22s
    3. Current web standards
      2m 12s
  3. 43m 9s
    1. The Welcome screen
      4m 5s
    2. Windows and Mac interface differences
      2m 23s
    3. The Application toolbar
      4m 7s
    4. The Document toolbar
      4m 40s
    5. Arranging panels
      8m 19s
    6. Managing workspaces
      7m 32s
    7. The Properties Inspector
      5m 54s
    8. The Insert panel
      6m 9s
  4. 25m 45s
    1. Basic site structure
      3m 11s
    2. File naming conventions
      1m 49s
    3. Defining a new site
      4m 35s
    4. Managing sites
      4m 51s
    5. Managing files and folders
      6m 36s
    6. Working with browsers
      4m 43s
  5. 27m 21s
    1. Creating new documents
      5m 16s
    2. New document preferences
      3m 6s
    3. Setting accessibility preferences
      4m 56s
    4. Working with starter pages
      3m 46s
    5. Managing starter pages
      10m 17s
  6. 30m 2s
    1. Basic tag structure
      2m 15s
    2. Adding structure to text
      8m 20s
    3. Creating lists
      9m 59s
    4. Getting text into Dreamweaver
      5m 59s
    5. Importing Word documents
      3m 29s
  7. 1h 17m
    1. Understanding style sheets
      2m 16s
    2. The anatomy of a CSS rule
      1m 48s
    3. Setting CSS preferences
      6m 36s
    4. The CSS Styles panel
      10m 2s
    5. Controlling CSS through the Properties Inspector
      5m 14s
    6. Using the Code Navigator
      7m 21s
    7. Using CSS Enable
      6m 45s
    8. Understanding element selectors
      8m 11s
    9. Understanding class selectors
      8m 49s
    10. Understanding ID selectors
      5m 59s
    11. Understanding descendant selectors
      6m 51s
    12. Attaching external style sheets
      7m 44s
  8. 1h 47m
    1. Working with units of measurement
      7m 11s
    2. Declaring font families
      9m 39s
    3. Controlling font sizing
      9m 9s
    4. Controlling weight and style
      8m 0s
    5. Controlling line height
      8m 29s
    6. Controlling vertical spacing with margins
      12m 3s
    7. Controlling spacing with padding
      5m 39s
    8. Aligning text
      8m 26s
    9. Transforming text
      5m 36s
    10. Writing global styles
      15m 42s
    11. Writing targeted styles
      17m 37s
  9. 1h 32m
    1. Understanding image types
      5m 3s
    2. Managing assets in Dreamweaver
      12m 51s
    3. Setting image accessibility preferences
      4m 20s
    4. Setting external image editing preferences
      3m 52s
    5. Placing images on the page
      7m 37s
    6. Photoshop integration
      5m 54s
    7. Modifying Smart Objects
      5m 51s
    8. Alternate Photoshop workflows
      8m 8s
    9. Modifying image properties
      11m 14s
    10. Styling images with CSS
      7m 11s
    11. Using background graphics
      9m 3s
    12. Positioning background graphics
      11m 6s
  10. 55m 16s
    1. Link basics
      3m 37s
    2. Setting site linking preferences
      2m 14s
    3. Creating links in Dreamweaver
      11m 1s
    4. Absolute links
      5m 8s
    5. Using named anchors
      11m 19s
    6. Linking to named anchors in external files
      2m 44s
    7. Creating an email link
      5m 24s
    8. Creating CSS-based rollovers
      13m 49s
  11. 1h 34m
    1. CSS structuring basics
      2m 56s
    2. The Box Model
      13m 21s
    3. Understanding floats
      6m 53s
    4. Clearing and containing floats
      8m 56s
    5. Using relative positioning
      4m 8s
    6. Using absolute positioning
      7m 18s
    7. Creating structure with div tags
      12m 7s
    8. Styling basic structure
      10m 34s
    9. Creating a two-column layout
      10m 37s
    10. Using Live View and CSS Inspect
      7m 51s
    11. Using Browser Lab
      9m 39s
  12. 56m 22s
    1. Reviewing table structure
      7m 41s
    2. Importing tabular data
      5m 13s
    3. Creating accessible tables
      9m 56s
    4. Using thead and tbody tags
      4m 0s
    5. Basic table styling
      8m 45s
    6. Styling table headers
      7m 52s
    7. Styling column groups
      4m 22s
    8. Creating custom table borders
      5m 1s
    9. Styling table captions
      3m 32s
  13. 1h 43m
    1. How forms work
      3m 0s
    2. Reviewing form design
      3m 2s
    3. Creating accessible forms
      7m 33s
    4. Setting form properties
      4m 6s
    5. The fieldset and legend tags
      4m 32s
    6. Inserting text fields
      5m 58s
    7. Inserting list menu items
      5m 26s
    8. Inserting checkboxes
      7m 50s
    9. Inserting radio button groups
      6m 22s
    10. Inserting text areas
      4m 12s
    11. Inserting submit buttons
      3m 37s
    12. Basic form styling
      12m 0s
    13. Form element styling
      8m 52s
    14. Styling form layout
      11m 49s
    15. Adding form interactivity
      2m 47s
    16. Using Spry validation widgets
      12m 49s
  14. 1h 23m
    1. Planning for templates
      10m 51s
    2. Creating a new template
      10m 37s
    3. Using editable attributes
      13m 43s
    4. Creating optional regions
      6m 23s
    5. Creating new pages from a template
      9m 17s
    6. Applying templates to existing pages
      6m 9s
    7. Working with nested templates
      7m 56s
    8. Working with repeating regions
      12m 58s
    9. Modifying templates
      5m 41s
  15. 40m 14s
    1. Behaviors overview
      3m 47s
    2. Hiding and showing elements
      9m 18s
    3. Spry overview
      4m 4s
    4. Using Spry widgets
      11m 36s
    5. Adding Spry effects
      3m 6s
    6. Using the Widget Browser
      8m 23s
  16. 28m 18s
    1. Inserting Flash files
      5m 4s
    2. Setting properties for Flash
      6m 27s
    3. Dreamweaver and Flash integration
      6m 6s
    4. Encoding Flash video
      6m 10s
    5. Adding Flash video
      4m 31s
  17. 45m 28s
    1. Running site-wide reports
      6m 33s
    2. Checking for broken links
      5m 41s
    3. Checking for browser compatibility
      8m 3s
    4. Adding remote servers
      8m 0s
    5. Uploading files
      7m 20s
    6. Managing remote sites
      9m 51s
  18. 34s
    1. Goodbye
      34s

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 Dreamweaver CS5 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.