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.
It's not uncommon to add styles throughout your project. It's actually really quite rare for a designer to sit down and write all the styles for a site in one sitting. Yeah, most of the time it's a very organic process and because of this, it's very easy for styles to become unorganized or for them to gain unnecessarily in size. The organization of styles is incredibly important. Not only will it help you maintain and update the site a little bit later on, but it also prevents style conflicts from causing major problems in your files. In this movie, I want to show you how to use the CSS Styles panel to keep your styles organized.
To do this, we're going to be working in the index file from 06_05 folder. I'm going to modify my CSS Styles panel a little bit here. I'm going to take this Properties pane and I'm going to minimize that all the way down to where it's just not even visible anymore. And the reason for that is because we have a lot of styles in this file. We're going to be moving some around, and I want to have enough visual space in order for me to do that in a fairly efficient manner. Well, I notice that we have two things going on here. We have an external main.css file and then we have some embedded styles within this particular document.
If open those up, I could see that they're all classes, and for the most part they aren't classes such as this one, homeHeader, that apply to this file, but there are the ones such as course, orange, blue, lavender, those apply to everything within the site. So there's really no reason for them to be just on this page. It's not a very efficient way of handling those. I actually need those selectors inside my main.css file, so that the rest of my site can benefit from them and it's going to also help with my organization. So I need them moved from my styles here up into main.css.
Now one way for me to that would be to go to the actual code itself. I could switch over to Code view, I could go up to the styles themselves, and then I could just copy and paste them where I needed them within main.css. And that really doesn't take probably that long, but one of the really nice things about the CSS Styles panel is that I can move rules around, not only within one style sheet, but from one style sheet to another, which is an amazingly powerful feature. So what I'm going to do is I'm going to go ahead and select the first four classes.
Now I can do that by clicking on one, holding the Shift key down and clicking on the last one, so these four, course, orange, blue, and lavender. I'm going to expand main.css, because this is going to help me decide exactly where to place these. And then I'm going to take these four that I've selected, hold the mouse down and I'm going to drag up. Now you'll notice that as I begin to drag up, I see this blue bar that shows up as I'm scrolling through. Essentially what that's telling you is okay, if you let go of the mouse, this is where those selectors are going to be copied to.
I'm going to go all the way up to the top, so that it scrolls a little bit and then I'm going to find these section of classes right here. Now because I wrote the style sheet, I happen to know that this section of styles is in a little session called global classes, and that's what these guys are. So even though I wrote these styles and I created a section of global classes, for whatever reason, as I was working maybe with this page, I went ahead and created more classes and embedded them in this file. So now at this point, I need to reorganize my styles and make sure they're in the right place.
So I'm going to move them up just below where it says .more and as soon as I let go of the mouse, I can see that it adds those selectors right there. Now what Dreamweaver just did for me was a very physical thing. If I look back in the Source Code, if I switch back over to the Source Code, I now notice that those selectors are not there anymore. They're not there any longer. If I go over to main.css and I scroll into these global classes, I can see there are course, orange, blue, and lavender, they've been physically moved from one style sheet to another and I was able to do all of that without going into the code.
That's a pretty powerful feature. Now I'm going to complete this by going down to the homeHeader, which really belongs to a different set of styles and I'm going to click on that and move this up into where the other header styles are. And as I scroll this up, I can see right here we have programHeader, aboutHeader, graphics and request. I'm just going to place it at the very top of these headers, because it is the homepage, so I'm going to place it between this programHeader and pageHeader hover style. As soon as I do that, it's going to physically move it within my styles and I'll notice that the style tag is now empty.
Now if that style tag is now empty and I don't plan on adding anything to it later on, it doesn't really need to be there. So at the current time in the head of my document, I just have this sort of empty style tag if you will. So again, using the CSS Styles panel, I can simply click on that, come down to the Trashcan and click, and it's literally going to remove that from the Source Code. So again, that's just one of the awesome things about the CSS Styles panel. I can visually and very quickly make significant edits to my code and organize my styles, which is awesome.
Now there are additional things this allows me to do as well, and I'm guessing that more than one of you, when you're watching this exercise, because I do this myself, when you were selecting one of these styles, you probably selected it and clicked it again to move it, and instead of moving, you saw this. All right! Well, that option allows you to rename a selector and that's sometimes really, really important. For example, if I scroll down through my styles, I can find down here towards the bottom this really weird selector here. This selector says body/article #mainContenth2. That's very, very specific.
It's applying to any h2 which is inside of an article with an ID of mainContent, which is inside the body tag. Well, that's way more specific than it needs. Look at all the other selectors around it. They just say article h1, article h3. So I think I got a little overzealous when I wrote that particular selector. So what I'm going to do is I'm going to click it once to highlight it, then I'm going to click it again a short time after that, and when I do that, what that's going to do is it's going to focus on the actual selector itself and I can rename the selector. What I'm going to do is I'm going to get rid of everything, except for the h2 and in front of the h2; I'm just going to type in article, and then make sure there's a space between h2 and the article.
So what it should read is article space h2. Now you need to be very, very careful when you do this, because it's so easy to forget a space or not add a space in the right place or delete the wrong thing and I have something spelled correctly. So when you're writing your selectors and only when I'm writing in the code, it just seems that I'm paying a little bit more attention to that. But in this panel, it's sometimes really hard to tell exactly where spaces and dots are, so you want to be really careful about that and you want to test those selectors out, before you begin actually moving on to another task.
With that said, I'm going to do Save All, I'm going to switch this over to Live view, and as I switch it over to the Live view, if I scroll down, I can see there is the selector that we just styled and the styling is coming through so that worked out just fine. So even if you're the type of person that enjoys hand-coding, managing and organizing your styles through the CSS Styles Panel is often actually faster, to be honest, although you should strive to author your styles with a clear strategy and attempt to keep them organized as you work.
I mean, let's be honest, it's the real world. It's nice to know that even if things get a little out of hand, you can use the CSS Styles panel to bring order back to your chaos, without requiring an all-night coding session.
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.