Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
Discover how to build web sites, prototypes, and more in this course on Adobe Dreamweaver CS6. Author James Williamson shows designers how to take control of their site by properly naming and structuring files and folders; how to create new documents and web pages from scratch or with starter pages; and how to add content such as text, images, tables, and links. James also provides a background on the languages that power projects built in Dreamweaver—HTML and CSS—and introduces the programming features in the application, for developers who want to dig right into the code. The last chapter shows how to finesse your project with interactive content such as CSS3 transitions and Spry widgets.
You can add a tremendous amount of customization to your form elements through styles. Just be sure that any changes that you make to the default appearance of a form element, doesn't confuse users as to that form element's purpose. We're going to finish out our form by styling our individual form elements to match the Roux Academy's website's design. So again, I'm in the request.htm and just like I did in the last movie, I'm going to switch over to my main.css and just switch over to Code View and style my form elements. Now if I scroll down, I remember we're a little bit further down into the styles, around Line 590 or so, there are a couple of styles that have been added since our last exercise and they're really just sort of styling some of the list items and some of the labels like the labels for the text fields.
We want to focus our styling efforts this time on the individual form elements. Now one of the reasons why I'm definitely encouraging you to do this one by hand is because we're going to be using attribute selectors in this lesson. And attribute selectors in CSS allow us to target elements on the page with an attribute or an attribute of the specific value. So they're very, very useful selectors that you should be familiar with using. So our first selector is going to be little bit of a doozy here, so follow with me witih this one. We're going to do input and then I'm going to use a Square Bracket and you can find the Square Bracket just to the right of the P key.
You just don't hold the Shift key because you don't want the Curly Braces; you want Square Bracket. So I'm going to do input Square Bracket, no space there, and then I'm going to type Equals and then in Quotation Marks text. Close the Quotation Marks, close the Bracket. So essentially it's saying, hey, find any input element, remember, our form elements are all inputs for the most part, find any input element whose type equals text. So of course, it's just going to target, in this case, the text elements on the page. Now I have multiple different types of inputs that I want to target with this exact same selector, so I can group selectors together by using a Comma.
So right after that selector, I'm going to type in a Comma and then I'm going to type in the next selector that I also want to be affected by this formatting. So now I'm going to type in input, again, Bracket notation, type Equals email. So I think you can see kind of where we're going with this. We're targeting all of the text elements we placed in the page even though they might have different type attributes. The next thing we're going to do is input and then again, in Bracket notation type Equals search. Now I know we didn't put a search element on this particular page, but it's found elsewhere within the site so it makes sense to just style them all together.
And then finally, I'm going to do a textarea and then do a select. The textarea is of course the comment text box and when I hit Comma and do select, select is going to be our Submit button. So now I'm going to open up my Curly Braces, hit Enter twice and build that out. So we have this very long selector, but it's really doing nothing other than going into our form and cherry-picking specific elements that we want to style. All right! So I'm going to click inside that and I'm going to turn their border off. All input text fields have a default border. I'm going to turn that off by saying border: none. Then I'm going to give them a background color, this is going to replace the default background which is often white or sort of a gradient, so I'm going to replace that with an rgb color that comes from our site.
In this case, it's going to be that yellow color, so 249, 228, 130. I'm also going to set the width of this; I'm going to set the width to 318 pixels. That's going to give them all the defined width, it's exactly the same, it's going to help the form actually look a lot more organized because it's going to line all these guys up. The labels themselves are going to be above the form elements, so I don't have to worry about the label in effect interfering with the alignment of these form elements. Then finally, I'm going to do padding of .5 ems and then a font-size of 1 em.
So again, I'm making the text that's entered into the text field 1 em, so that's the text that people are going to see as they type in. Okay, let's keep going. I need to do a very specialized style for textarea, so I'm going to write a selector for it all by itself. Now the reason we're not adding the styling of course to our previous selector is because I only want this to apply to textarea. And this is a very small one, I'm just going to do a height of 128 pixels. All right! What is the height going to do for us? Well, that's going to drive exactly how much of the text that somebody types in can see at any given time.
There is an attribute that you can set on the text area tag to do that, but it's a little bit nicer and you have a little bit more control over doing that with CSS. All right! I'm going to going. I want to add some user interactivity to our form. I'd love it if we could let our user know kind of where they are within the form and how they're progressing through it. That's actually very easy for us to do by using a certain pseudo-selector. And that would be the focus pseudo-selector. So in the past, we've used hover; in this case, we're going to use focus. So I'm going to type in input. Remember, most of our form elements are inputs, I'm going to type in input:focus, textarea; it's like the only one that isn't, :focus.
So again, no space there. So I'm grouping those two together, I'm saying, hey, any input, and that could be any form element when we're focused into that, and the text are when that's focused into as well, let's go ahead and style that. And what we're going to do with this is just place a border around it. So we're going to do a border of 2 pixels solid and we're going to do that purple color which is rgb(168,88,163). So we're going to getting there.
I'm going to go ahead and save this and we've got just a couple more selectors to do. The next one I'm going to do another input selector and this time I'm going to target the Submit button. So I'm going to type=submit. I'm going to build out my Curly Braces and then inside that we're really going to go to tell in the formatting here. I'm going to do a background, so I'm going to strip out the default button background and I'm going to do rgb(2,99,174); that's the blue color that we've been using in our site.
I'm going to do a color of white and that's going to be the text of the actual button itself. I'm going to do some padding of .2 ems space .4 ems, so that's going to control how much size around the text the button has. I'm going to do no border, so a border of none is going to turn off the default border on this button. I'm going to do a font-size of 1 em and that's going to control how big the text within the button is. And I'm also going to turn the cursor on, I'm going to do a cursor of pointer, and any time that you're going to do something like this where you strip of the default styling of a button, it's really helpful if you let the user know that yes, this is indeed some something you can click on.
So in case that didn't get displayed by a certain user agent, I'm going to go ahead and explicitly tell the cursor to be the pointer. All right! So I'm going to save this. I'm going to go down to the next line and I'm going to type in select and remember, the selects are our pulldown and out lists. For those guys I'm going to give them a width of 328 pixels, so it makes them a little bit wider than the input text boxes, but in reality, because of the chrome, that width is going to look very similar to what we have for our text boxes. And then finally, I want to style the selected as the multiple list, so I'm just going to select and then a Bracket notation and multiple. All right! So what's going with this selector, well, with this selector, again, it's an attribute selector but it doesn't test for any specific value.
It just says, hey, does the attribute multiple exist. If it does, let's go ahead and style it. That way it's going to grab the list item but not the menu item. And in this case, I'm going to give it a height value of 162 pixels and that's going to control how many items within the list that I can see at any given time. All right! I'm going to go ahead and save this and then I'm going to preview this in any one of my browsers; it doesn't really matter. And as I scroll through, I can now see all our default styling. If I click on a form element, you can see the focus that we've established, the height of this is allowing me to see all the elements at once, and there's the height of my text area and the Submit button notice how drastically different it looks.
It doesn't really look like a button anymore, but when I hover over it, I get the little icon that tells me yes, this is indeed clickable, and when in my click, it's going to take me to the processing page. So our form now has a very clear visual styling that matches the rest of our site which is what we're going for. And by taking the advantage of Dreamweaver's form objects, when you place these in the page, you can quickly build well- structured accessible forms, and then as we've just done, style the form to match the rest of your design. And keep in mind that in order to truly build solid forms, you're going to need to do considerable planning on the front end, and unless you're going to be building the back end of your site as well, you'll need to consult with your developer to make sure the form that you're designing will work with the form processing that will be performed once the form is submitted.
There are currently no FAQs about Dreamweaver CS6 Essential Training.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.