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

Exploring basic form styling

From: Dreamweaver CS6 Essential Training

Video: Exploring basic form styling

Now that our form structure is complete, we can concentrate on making it fit the visual design of our site. We're going to do this by writing styles that target individual form elements and by taking advantage of the additional structure that we've added to our form with the Fieldset and Legend tags. So I have the request.htm file open here from the 10_11 folder, and I want to show you something because I've added a little bit to the code here. If I scroll down into my form, if you scroll down and look through this form, occasionally, you're going to see different classes that have been applied.

Exploring basic form styling

Now that our form structure is complete, we can concentrate on making it fit the visual design of our site. We're going to do this by writing styles that target individual form elements and by taking advantage of the additional structure that we've added to our form with the Fieldset and Legend tags. So I have the request.htm file open here from the 10_11 folder, and I want to show you something because I've added a little bit to the code here. If I scroll down into my form, if you scroll down and look through this form, occasionally, you're going to see different classes that have been applied.

For example, you can see here this label has a class of text applied to it. Now, that wasn't done when the form elements were placed on the page. I did that sort of in between the exercises if you will as a way of identifying specific things. For example, I am identifying all of the labels that apply to text elements by using this class, and that's going to help me style them very, very specifically apart from the other labels that we have within our form. So a lot of times, when you're organizing and thinking about how your form is going to be styled, now realize the fact that sometimes you're going to have to go in, and add additional attributes like class attributes to make sure that your forms are styled the way that you want them to be.

When you do that however, take some consideration and time to use sort of semantic naming for these. For example, the class of text is pretty easy to understand that these labels apply to text elements. So you want to go in and think about exactly how you're structuring your form elements, and what you're going to need to do in order to style them properly. Now, I am going to click over to main. css just like before when we were starting to style our tables, some things are a little better done by hand. Now, you could certainly go over to the CSS Styles Panel if you're the type of person that really prefers to do this visually, we've gone to the CSS Styles Panel before and created rules.

So I'm sure you understand and know that process. We're not going to be doing anything so far that's not available in that dialog box, it's just that hand-coding this is going to be a little bit quicker for us. So I am going to scroll down into my Styles, and I want to go down to about line 588, and then I can find a little comment that says form styles. I am going to place my cursor just beside that. So in this exercise, we're going to do some really basic form styling, and that's essentially, taking all those sort of organizational areas that we have and styling those. So the first thing we're going to do is style the form itself, so I am just going to do a form selector, and inside that, I am going to do a margin-bottom of 1em on the form.

So what that's going to do for us is it's going to take any content that might appear below the form, and it's going to give a little bit of space between those two, so that, that content and the form aren't running right into each other. The next thing I want to do is style my fieldsets. Now, a lot of people will place a solid background color on fieldsets, I certainly do that a lot myself. But, in this case, I want to do some very simple fieldset styling. The first thing I want to do is turn the border off. So I am just going to go ahead and do a border of none. The next thing I want to do, I want to do a custom border-bottom on this.

Now, you maybe thinking to yourself, wait a minute! Why are you doing two separate ones for border? Well sometimes, it's just easy to turn it off, and then immediately turn back on just the part of it that you want there. Now for this particular border on the bottom, I am going to do a 1 pixel border solid, and the RGB value for this is going to be 2,99,174 which is the blue that we have up in our color palette. Next, what I am going to do is I am going to do a margin-bottom on the fieldsets as well. Remember, we have more than one fieldset. So by placing a bottom-margin on it is going to give us some spacing between those form elements.

The next thing I am going to do is assign a specific width to my fieldsets and I am going to give this a width of 486 pixels. So what that's going to do for us is it's just going to sort of define the space that our fieldsets are going to be taking up within the article that they're sitting inside of. Okay. Now, I really wanted that bottom-border on the fieldset to just separate the two fieldsets that I have, again, give it a nice visual clue. But, because both of them are fieldsets, the bottom fieldsets is also going to have a line on it, and that's going to look kind of goofy. So what I want to do is go down to the next line, and I am going to type-in fieldset:last-child.

So this is one of the reasons I like doing this by hand because typing that in the CSS Rule Definition dialog box can be a little trying. So this is going to be fieldset:last-child and it's basically going to say the last fieldset in this form, and there is only two of them, go ahead and do this, and of course what I am going to do there is border of none and it's going to turn off all the borders on the bottom one. So, we'll have a border between the first and the second one, but not past the second one. All right! So I am going to keep going, and the next thing I want to do is style my legend elements. Now, to be honest with you, styling legends is a pain, there's no two ways about it.

So let's take a look at what we're going to do with the legend element here, and then I will talk a little bit about styling now. So the first thing I am going to do is I am going to do a font-family, and my font-family for the legend is going to be Bitter, Georgia, Times, and serif, now that's a stack that we built earlier and saved in the favorites. If you didn't do that lesson along with us, just type those in, Bitter, Georgia, Times, and serif. Bitter is a web font, and then Georgia, Times, and serif are system fonts that they can fall back to if the browser doesn't or a user agent doesn't support web fonts.

The next thing we're going to do is font-size, and I am going to size it of 1.4 ems, and then finally I am going to do a color and the color is going to be rgb(251,174,44). Before we move on, I want to talk a little bit about styling legends. You will notice, now I didn't do anything here in terms of placement, I didn't try to move it anywhere, I didn't try to mess with its margins or its paddings. Well, legend is hard to move around, as a matter of fact, most people will use a trick like placing it inside of a span tag, absolutely positioning the span tag and moving that around so the legend moves with it.

It is a real pain to move, because different browsers basically positioning it using different values and different CSS properties. So it's one of those elements that's just really tricky to get a handle on, on how to style it. So my advice to you when styling legend elements is to keep it as simple as possible. All right! A couple of more styles and we're going to be done. I am going to go down in the next line and I am going to type-in the form ul, so I am going to be targeting the unordered list that's grouping or form together. And for this one, I am going to do list-style of none.

It's going to turn those bullets off, so we don't see those, and then I am going to give it a Padding of 0, and a Margin of 0 as well. It's going to get rid of any of the default spacing and the default indentation of our unordered list. So it's going to make life a little bit easier by just stripping out all of the default list styling. Next up, I am going to do form li, so now that's going to target the list items, the sort of the parent elements of all of our form moments, and here, I am going to do a margin of 0, so just initially turning everything off. And then once again I am going to do a margin-bottom; so again, that technique of sort of turning it off and then flipping one of them back on again.

Bottom margin of 1 em, that's going to space our form elements apart from each other, give it a padding of 0, so again stripping off any default padding, and then finally, font-size. I am going to make font-size a little bit smaller; 0.9 ems, and that's going to make all the text including the labels inside of it just a little bit smaller than the text around it. Finally, our last selector for this particular movie, I am going to do study li, it's going to target any list item inside of an element that has a class of study applied to it, and what we're going to do there is we're going to do a margin-bottom of 2 ems.

So what that's doing for us is that we have a certain grouping of styles that I wanted to put a little bit more space between, the menu items for example. So I created a custom class that's going to help me do that. All right! I am going to go ahead, and save this, and I just want to preview it in my browser, so I can sort of see my default form styling. One of the nice things is you can see that sort of line that's going between our fieldsets, so that's nice, it gives our form a nice visual spacing. There is our legends, it's using the orange color that we asked for. But, the form elements themselves really aren't styled all that well. So we've organized the areas, the regions, we're controlling the spacing a little bit, but the form elements themselves need a little bit more styling, and that's what we're going to focus on in our next movie.

Show transcript

This video is part of

Image for Dreamweaver CS6 Essential Training
Dreamweaver CS6 Essential Training

90 video lessons · 54196 viewers

James Williamson
Author

 
Expand all | Collapse all
  1. 1m 4s
    1. What is Dreamweaver?
      1m 4s
  2. 5m 44s
    1. Welcome
      1m 4s
    2. Using the exercise files
      2m 17s
    3. Learning web design
      2m 23s
  3. 1h 0m
    1. Looking at the Welcome screen
      5m 9s
    2. Exploring Windows and Mac interface differences
      5m 6s
    3. Arranging panels
      8m 44s
    4. Managing workspaces
      10m 14s
    5. Exploring the Application toolbar
      6m 21s
    6. Exploring the Document toolbar
      8m 47s
    7. Working with the Property inspector
      9m 30s
    8. Using the Insert panel
      6m 30s
  4. 53m 3s
    1. Understanding basic site structure
      3m 46s
    2. Exploring file naming conventions
      2m 10s
    3. Defining a new site
      5m 23s
    4. Managing files and folders
      7m 57s
    5. Adding remote servers
      7m 4s
    6. Uploading files
      12m 46s
    7. Previewing in browsers
      9m 11s
    8. Managing multiple sites
      4m 46s
  5. 36m 41s
    1. Creating new documents
      6m 49s
    2. Setting up new document preferences
      5m 30s
    3. Setting accessibility preferences
      6m 49s
    4. Working with starter pages
      4m 32s
    5. Managing starter pages
      13m 1s
  6. 37m 23s
    1. Getting text into Dreamweaver
      8m 43s
    2. Importing Word documents
      4m 6s
    3. Adding structure to text
      7m 35s
    4. Creating lists
      4m 35s
    5. Creating definition lists
      4m 0s
    6. Using the Quick Tag Editor
      8m 24s
  7. 44m 41s
    1. Exploring the Code toolbar
      5m 41s
    2. Setting code preferences
      7m 19s
    3. Using code hints
      8m 8s
    4. Wrapping tags
      5m 7s
    5. Adding comments
      6m 29s
    6. Using snippets
      7m 32s
    7. Formatting source code
      4m 25s
  8. 1h 19m
    1. Setting CSS preferences
      9m 32s
    2. An overview of the CSS Styles panel
      9m 23s
    3. Creating a new CSS rule
      6m 42s
    4. Using the CSS Rule Definition dialog
      7m 25s
    5. Organizing styles
      7m 22s
    6. Modifying style properties
      6m 17s
    7. Controlling CSS through the Property inspector
      6m 37s
    8. Attaching external style sheets
      5m 54s
    9. Using CSS visual aids
      7m 3s
    10. Using CSS Inspect
      6m 48s
    11. Using the Code Navigator
      6m 39s
  9. 1h 11m
    1. Managing assets in Dreamweaver
      7m 30s
    2. Setting external image editing preferences
      4m 26s
    3. Placing images on the page
      10m 12s
    4. Exploring Photoshop integration
      7m 17s
    5. Modifying Smart Objects
      9m 42s
    6. Modifying image properties
      8m 4s
    7. Styling images with CSS
      6m 45s
    8. Using background graphics
      7m 28s
    9. Positioning background graphics
      10m 10s
  10. 36m 23s
    1. Link basics
      3m 17s
    2. Setting site linking preferences
      2m 19s
    3. Creating links in Dreamweaver
      9m 17s
    4. Using absolute links
      3m 43s
    5. Using named anchors
      6m 41s
    6. Creating an email link
      5m 25s
    7. Creating CSS-based rollovers
      5m 41s
  11. 44m 30s
    1. Reviewing table structure
      5m 20s
    2. Importing tabular data
      6m 46s
    3. Creating accessible tables
      6m 11s
    4. Exploring basic table styling
      9m 42s
    5. Styling alternate rows
      8m 57s
    6. Creating custom table borders
      7m 34s
  12. 59m 15s
    1. Understanding how forms work
      2m 45s
    2. Reviewing form design
      3m 44s
    3. Creating accessible forms
      5m 16s
    4. Setting form properties
      2m 39s
    5. Using the fieldset and legend tags
      2m 52s
    6. Inserting text fields
      6m 56s
    7. Inserting list menu items
      7m 54s
    8. Inserting checkboxes
      4m 14s
    9. Inserting radio button groups
      3m 52s
    10. Inserting submit buttons
      2m 25s
    11. Exploring basic form styling
      8m 2s
    12. Exploring form element styling
      8m 36s
  13. 33m 25s
    1. Adding CSS3 transitions
      8m 29s
    2. Spry overview
      2m 44s
    3. Using Spry widgets
      3m 57s
    4. Adding Spry effects
      8m 1s
    5. Using the Widget Browser
      7m 4s
    6. Extending Dreamweaver
      3m 10s
  14. 1m 2s
    1. Additional resources
      1m 2s

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 CS6 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.