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

Dreamweaver CS5 Essential Training

From: Dreamweaver CS5 Essential Training

Video: Styling form layout

We need to continue styling our form by completing our form layout and ensuring that our labels are positioned properly. The position of labels and the form elements they represent is in the end a personal choice, but the majority of forms place all labels in front of their form elements except for radio buttons and checkboxes, which tend to display the labels after the elements. In addition to styling our labels correctly, we also need to bring some order to our checkboxes and they are a mess right now. As they are now in separate paragraphs, that creates way too much vertical spacing and it's going to be confusing to any of the users using our form.

Styling form layout

We need to continue styling our form by completing our form layout and ensuring that our labels are positioned properly. The position of labels and the form elements they represent is in the end a personal choice, but the majority of forms place all labels in front of their form elements except for radio buttons and checkboxes, which tend to display the labels after the elements. In addition to styling our labels correctly, we also need to bring some order to our checkboxes and they are a mess right now. As they are now in separate paragraphs, that creates way too much vertical spacing and it's going to be confusing to any of the users using our form.

So, using just a little bit of extra markup, we're going to display our checkboxes in three columns and that should help organize our form greatly. So here we have the join.htm from the 12_14 explorers directory open. Once again, I've collapsed our panels down and I'm focusing on the CSS on the left side of our Split View and the form on the right side. Now, I've taken the liberty of doing a few things for our form and I want to point out to you guys what I have done. So I'm going to scroll down a little bit and find our checkboxes and you're going to see they look a little different.

I didn't say they look better yet, but they look a little different. These dotted lines that you're seeing here are div tags. I've taken our checkboxes, we have nine of them, and split them up into three groupings of three. So, if you would look at the source code, let me go ahead and click on these again, you would see that these checkboxes are now surrounded by div tags and the div tags have a class of column 1, column 2, and column 3. So, there is column 1 and you can see that's it right there. There's column 2, you can see it right there, and there's column 3.

So if you were ever wanting to do this yourself, all you have to do is find your checkboxes, highlight them, and then you can use this little tool right here, Wrap Tag, to wrap them in a div tag and assign them an ID or in case of what we've done here, a class. That just saved us a little bit of time not having to do that ourselves. One more thing, if I scroll down and look at the labels beside our radio buttons, I can see that they have a class. I can see that using our Tag Selector right here. They have a class now applied to them called inline. So we're going to write a selector that's going to take advantage of that in just a moment.

So, I'm going to go back to the main.css, there we go, scroll down. Remember we're on about Line 650, somewhere around in there, and we're actually going to go down to the Join forms around the 689-700 range. We're going to start adding our code here. All right, let's tackle our checkboxes first. I mean that's a big task, so we'll go ahead and get that out of the way. So, on about line 700 there, I'm going to type in #mainContent form#frmJoin, so just the same as we've been doing before, space .col1.

So remember the dot indicates that it's a class and we're looking for col1. So, any element with the class of col1 found in the frmJoin form, found in mainContent. I'm going to open up our curly brace and hit Return to go down to the next line and here I'm going to float these to the left. That's going to help us give us our three-column layout. I'm going to give them some padding to the left. So, padding-left of 20 pixels. margin-right, that's going to keep these guys away from each other a little bit. margin-right 20px and I am going to give the first column a width of 160 pixels.

I calculated that by calculating the width of the fieldset that they were inside of, how wide their labels need to be, and then kind of sort of splitting the difference. So if you're wondering how did he know how wide to make that, you basically just figure out how wide your fieldset is going to be, how much width you need for each of your labels, and kind of factor it that way. Now, I'm going to go down to the next line and write a selector for both of my remaining columns. So #mainContent form#frmJoin .col2.

Now, we're going to apply the same rule to the next two. So I'm actually going to do a comma to group these together, highlight the previous rule and copy it, because there's no reason to type all that over again, and then simply paste that after the comma. Change col2 to col3 and now we have a group selector that's targeting the column 2 and the column 3 at the same time. I'm going to open up my curly brace, hit Return to go down to the next line, and here I'm going to type in float left just as we did before. These are also going to have a margin-right of 20 pixels.

So for right now, they are almost exactly the same. What is different? Well, on the next line, this time we're going to give them a width of 170 pixels. So they are going to be just slightly larger, about 10 pixels wider. If I do a Save All and click over here in our form now, we can sort of see a three-column layout coming to fruition. Now, the reason that we're not seeing a really nice three-column layout, number one, I'm still in Design View, and number two, our checkboxes and their labels are still just a little too large. So, using our styles, we're going to target the interior contents of these columns and sort of just shrink everything down a little bit.

So, on the next line in our code, right after that, we're going to type in #mainContent form#frmJoin div. So we're targeting div tags that are inside that form. To be honest with you, those are the only three div tags inside of that so we know exactly who we are targeting. So here we're going to do a little bit of margin work. I'm going to type in margin 0 0 20 pixels 0. So, top margin of 0, right of 0, bottom of 20 pixels and left of 0.

So what that's going to do is it's going to push those headings down a little bit there. Right below that, we're going to target our paragraphs as well inside of our div tag. So #mainContent form#frmJoin div p. So we're targeting paragraphs inside those div tags now. Once again open up our curly brace, and here you're going to type in margin, 0 for top, 0 for right, 0.5 ems for bottom, and then 0 for left, and don't forget to close your curly brace there.

So now those individual paragraphs, which remember the label and the checkboxes are fitting in a paragraph, that's going to help us space those guys a little bit closer and tighter together. Now finally, as far as our checkboxes go, let's go ahead and make the labels themselves a little bit smaller so that they fit in within those columns a little bit better. So #mainContent form#frmJoin div label. So really those are almost the same. We are just now targeting labels inside of these div tags as well.

Here, we want to change our font-size. So not just font, but font-size to 0.9 ems. So, we're shrinking them down a little bit. We're going to display them, so do a display inline. Then for floating, I'm going to choose none. So, that's going to take away sort of the default float that's been happening there. We want them to be on their own lines and we're going to display the labels inline so that the checkbox displays right beside. When we click on that now that looks a lot better, but if we go to Live View and scroll down, you can see that now we have our three-column layout. Perfect! Now, we're almost done.

You guys are doing a great job! I appreciate you hand coding. I hope that you are finding it to be a little bit to your liking at least. And we have three more rules that we need to write here really quickly. First, we need to make sure that our radio buttons are appearing on a single line. Right now, this is all really confusing. So let's go ahead and tackle that first. Right down below this rule, type in #mainContent form#frmJoin label.inline.

So we're targeting any label that has the class inline applied to it. We're going to turn float to none, so we're going to turn floating off and we're going to give it a width of auto. An auto width basically says ignore the width that was set earlier and allow the content itself to form the width of it. It's going to help that out a lot and you'll notice by clicking into this Design View, our radio buttons are now on a single line. Very good! Now, the only other thing we have left to do are these headlines. How many Explore California, I'm interested in the following tours, Profile Bio, those are all sort of subheadings and they really need to relate to that content a little bit more.

There's too much spacing there, there's no real great relationship between them, and the Profile Bio is sitting beside the form element, which just looks weird. So we're going to write a couple of selectors that are going to help us here and then we're going to apply some classes and the overall styling of our form is going to be finished. So, I'm going to type in #mainContent form p.subHead and subHead is going to be lowercase S, uppercase H. So that's basically saying any paragraph with a class of subhead applied to it inside of our form.

Down below that, we're going to type in margin, 0 for top, 0 for right, 0 for bottom, and 20 pixels for left. Then we're going to type in clear both. That's going to now allow any floating whatsoever. It's going to make sure that paragraph stays by itself, but more importantly, we're resetting our bottom margin to 0, which means there won't be a huge amount of space between our paragraphs and our form elements. One last thing. We need to do that to our label as well. So I'm going to go down below that and I'm going to type in #mainContent.

Now, here we're going to do something a little different. Type in now #mainArticle as well. So #mainContent #mainArticle, I'll talk about that in just a moment, form label.subHead. Open up your curly brace, go down the next line. Here we're going to change display to block. We're going to turn float to none. We're going to give it an overall margin of 0 all the way around and give it a width of auto, so that the label itself forms the width.

So what are we doing here? Well, the reason we're using this main article is because we want this label which is right here, it's going to be this little guy, to override all the things that came before. In order to do that, we had to make this selector a little bit more specific, which is why mainArticle is in there, because this form is in mainArticle as well as mainContent. We are changing the display to block. That means it's going to display on its own line. We're turning floating off and that is going to prevent our form element from floating up beside it like it is now. A margin of 0 means it's going to be up here right above it without a whole lot of spacing between it, and then the width of auto says don't limit yourself to the 125 pixels that we have put on the rest of the labels. You go ahead and be as wide as you want.

In order for us to do that, I'm going to turn off Live View. I'm going to click inside this text, use the Tag Selector right down here to select label and then I am going to choose subhead. You can see now it sits right on top of that form element and it's giving us the spacing that we want. I need to do the same thing with our paragraphs. So I am interested in the following tours. I'm going to click inside that paragraph. Click the P tag just to make sure that I've got that. Again, using the Properties Inspector, I'm going to give it the class of subhead. Then I'm going to do the same thing with right here, How many Explore California tours have you been on, grab the paragraph and make it subHead.

Now if we do a Save All, test that in our browser, and as I scroll down now this part of our form is aligning itself quite nicely. So, our form now has a robust layout, very clear visual styling. Although at this point our basic form is done from that standpoint, there is still a little bit of work left to do on our form. In our next movie, we're going to explore making our forms more effective by adding user feedback and interactivity.

Show transcript

This video is part of

Image for Dreamweaver CS5 Essential Training
Dreamweaver CS5 Essential Training

135 video lessons · 89898 viewers

James Williamson

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

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


You have completed Dreamweaver CS5 Essential Training.

Return to your organization's learning portal to continue training, or close this page.

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 preferences from 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.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

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.