An Overview of the CSS Styles Panel
An overview of the CSS Styles panel
The CSS Styles panel acts as a central hub for all things CSS in Dreamweaver, providing you with both a global view of all document styles, as well as allowing you to focus on individual rules in style applications. You'll find the CSS Styles panel in the CSS Panel Group, which is usually located at the top of the panel dock, although you can reposition it in custom workspaces if you'd like. If you don't see the panel, you can go up to Window and choose CSS Styles, and it should open up. Now, at the top of the panel you'll find buttons for two views; All and Current.
The Current View gives you a detailed view of all the rules applied to a selected element, while the All View gives you an overview of all the CSS Styles applied to the current document. Before we start creating styles in earnest, let's take a moment to get comfortable with finding our way around and using the CSS Styles panel. So to do that, I am going to work with the index file that we have here from the 06_02 folder. And you may have noticed the CSS Styles panel takes up a lot of room, especially when you have a lot of styles going on, so what I've done is I've sort of minimized all the other panels.
The Files Panel, I've got that minimized, I just have the CSS Styles Panel opened up. Now, currently we're looking at the All view, we'll take a look at the Current view in just a moment. And what I'm doing is with this Properties pane I am same sort of bringing it down a little bit so I can see more of these rules. All right! So currently what I am looking at right now is, I am looking at all of the rules that apply to the current document that I have open. So every time you open up a new document, if you have a different set of rules that apply to that, or that it's linking out to, you are going to see those listed there as well. Now, I want to minimize these really quickly so you can see the difference in how the CSS Styles Panel reports on the styles that you have attached to that particular document.
The first thing that I see listed is main.css. Now, that tells me that this is an external style sheet. How do I know it's an external style sheet? Well, there are a couple of reasons. Number one, I know because it has a .css extension, and number two, it's not within this sort of style tag that you're seeing here. Anytime you see the style tag represented like this, that's essentially an embedded style that's contained within the style tag in the head of the document. If I, for example, were to go over to Code View, you can see in the head of the document I have that style tag right there that's being reported by the CSS Styles panel.
And what's nice about that is it means that you're not going to have to do a lot of hunting through the code of your file to figure out which styles have been applied and what order those styles are in. The other very interesting thing here that we have about the CSS Styles panel is that the order that you see these in are the order that they are encountered in the code itself. And that actually is very, very important to CSS, because CSS has something called the cascade, cascading style sheets. Cascade basically says last rule applied wins. So obviously any rule that's further down this list, if there is a conflict to the rule above it, for the most part that rule is going to override the rule above it.
So this also helps you get an idea as to which styles are being applied and what order they are being applied in. Another thing that we get from this sort of basic overview of all the styles in our file are these two properties right here: screen and projection. That's basically telling you the value of any media attribute that has been applied to our style. So it's basically saying, okay, these particular styles are going to apply to any devices that are screen devices or projection devices. Now, that's actually handled when you use links to link to an external style, that's handled through this media attribute that you're seeing right here, so that's being reported in the CSS Styles dialog box, and once again, that's something that I'm not going to have to go into the code and check.
Now, if I don't see something there, that means the media attribute has not been defined. Now, as soon as I expand this, I can see every single rule in my external style sheet, which makes it very easy to scan through and kind of find what you are looking for. Now, obviously, how you've organized the style sheet matters, because you are going to see these rules in the exact order that they are found. Now, if you decide to highlight one of these rules or focus on it in any way, you're going to get even more information. So if I click on this rule right here, this pageHeader h1, you'll notice that the Properties panel below this now is activated and I'm seeing exactly what is contained within the rule.
As a matter of fact, I am just going to sort of move this up a little bit so I can see more of these, because I want to talk about the different ways that we can view these properties. You'll notice at the bottom left-hand corner of the CSS Styles panel that we have three icons. The first one shows your Properties in Category view. Now, in a moment we are going to talk about defining new CSS rules using the CSS Rule Definition dialog box. Essentially what you're seeing is these properties grouped into categories, such as all the properties that might be associated with the Fonts or the Box Model or Lists.
So if you're looking for a specific property and you know which category it's in, this is a very easy way to sort of sift through all of that and find exactly what you're looking for. Now, the next one is a List view of all the different CSS properties. You'll notice if I scroll through this, there are a lot of them. And to be quite honest with you, this isn't quite all of them, but it's very, very close. So what about the ones up top? Well, anytime you see a property that's in blue and it's at the top of this particular type of view, those are the properties that have actually been set on this rule.
So the ones down below it that are in black are not set, but you have the option of setting them. And then finally, we have the third view and this one is my favorite, and this is the Show Only Applied Properties. This filters it out so the only thing you're looking at are the actual properties that have been applied to this rule and the values of those properties. What's nice about this is anytime you see a property listed in blue in this panel, that means that you can click on that and you can change it. So if I wanted to change this say Margin value, I could just click on that and type in the value I wanted for the margin, same thing for the text-indent, the top position of this, any of these properties that I want to modify I can.
I can also add more properties here as well. So if I were modifying my CSS Styles, and we'll do this a little bit later on, I could go ahead and continue to add all the properties that I want without ever having to actually touch the code, which is nice. Now, I want to show off the Current View as well, but to do that we're going to have to focus on an element on the page itself. So what I am going to do is I am going to click inside this paragraph right over here, and then clicking on that I then want to focus on exactly the element that I want to look at in terms of its styling. And to do that I am going to use the Tag Selector right down here on the bottom. I am going to click right there in the <p.branding>, that means a paragraph that has the class of branding applied to it.
And once I click on that, it focuses on that. Now, the CSS Styles panel is going to pick up on the fact that I'm now focused on a specific element on the page. So if I go over to the Current view, you'll notice that it's giving me the rules for this <p.branding>. Now, here this can be a little bit more confusing the first time you see this, so I want to talk about what these different panes are. First off, notice that it's pretty easy for me to resize these panes so that I have a little bit more room in one versus the other. So the top pane is a summary for this selection.
It's not really focused on how many rules or which rules are applied to it, but it's basically saying, okay, here is like the entire styling for this, everything all combined, this is what it is. So it's very easy for you to look through this and determine whether the proper font or the proper size is being applied to that, anything like this. Now, the second pane, this middle one right here, this is the one that confuses the most people. This is the cascade essentially, the rules. So these are all of the rules in your styles that are applying to this element. There are a lot of rules that have properties applied to them that are then inherited by their children.
Now, in this case the paragraph is obviously a child of the home header area or the body tag and the styles that are applied to that will also a lot of times apply to the paragraph. And I can use this cascade rule to see if the selector that I wrote is applying in the order that I wanted it in. For example, <p.branding> selector right here, basically that is an element specific class selector, and it's saying that anytime you find a paragraph with a class of branding, apply this style. That's a pretty specific selector, because of that it is the last rule applied, meaning its properties are going to overwrite any of the properties of these rules if there's a conflict between them.
So I can very quickly and easily tell if the rule is applying within the cascade in the order that I want it. The next pane we have here is the exact same pane that we have in the All view, which is just the Properties itself, and I can come in here and I can change these properties and do whatever I want. Notice, for example, I can Add a Property. I am just going to go ahead and add one here, and I am going to add color. Now, I can grab this pull-down menu and choose color from that if I don't know all of those properties or know exactly which property I am looking for or I can just type it in, either way. When I choose color, it also gives me the option of going ahead and grabbing the color picker and choosing a color that way, or if I want, I can highlight the value and I could type in anything that I want.
So I could even use a keyword notation in this case, which is white, and I'll still get the same results. Now, as soon as I do a Save All and deselect this, you can see that, that color has now been applied to that rule. So it's a very quick and easy way to select an element on the page, flip right over to the CSS Styles panel, see what type of formatting is being applied to it, and then modify that, again, without ever having to go into the code. I know it probably seems to you like we've covered a lot of ground with the CSS Styles panel, but to be honest, we have really only just scratched the surface of what it can do.
Don't worry, we are going to be using the CSS Styles panel throughout the rest of the chapter, indeed as well as the rest of the title, which is going to give you plenty of time to familiarize yourself with these capabilities, as well as exploring some of its additional functionality.
Creating a First Web Site with Dreamweaver CS61,071,031 Views
Dreamweaver CS5 Essential Training3,633,578 Views
Flash Professional CS6 Essential Training1,404,491 Views
Dreamweaver CC and WordPress 3.8: Core Concepts154,251 Views
Fireworks CS6 Essential Training421,043 Views
PHP with MySQL Essential Training4,283,533 Views
HTML Essential Training3,833,338 Views
Illustrator CC 2013 One-on-One: Fundamentals1,678,359 Views