Using the Code Navigator

show more Using the Code Navigator provides you with in-depth training on Web. Taught by James Williamson as part of the Managing CSS in Dreamweaver show less
please wait ...

Using the Code Navigator

Although we've explored editing styles through the CSS Styles panel and the Properties Inspector, we haven't talked about the Code Navigator yet. The Code Navigator is an invaluable tool that gives you an easy way to access and modify your styles from anywhere in your document, even if you're not 100% sure which rule contains the styling that you need to change. So let's take a closer look at using the Code Navigator. I am going to scroll down a little bit, and looking at my tour descriptions down here, this formatting is not exactly the way that I want it. I want the text wrapping this image.

I mean, I like a little bit better spacing here for our rating text. So the first thing I am going to do is just click on this Big Sur image. I want to click on that. If I pause for a couple of seconds or so, this icon shows up, and it looks like a little steering wheel, or paddle wheel. That is the Code Navigator. If I hover over that and click it, it will bring up the Code Navigator itself. Now, that's one of the main reasons that a lot of people don't like the Code Navigator. Every time they click somewhere, a couple of seconds later up comes this little icon, and it can get to be a bit annoying. So if you click on that icon to bring up the Code Navigator, one of the things that you can do is disable it.

So by clicking that check box, you are turning that off, and you're not going to be bothered by that icon every single time that you click somewhere. You'll see that now when I click somewhere and just sort of hang out for a second. It doesn't come back up. So now that you have sort of gotten rid of the annoying factor of the Code Navigator, what happens if you need it? How you get it to come back up again? Go ahead and select your image. On the PC, you want to hold down the Alt key; on the Mac, you are going to hold down the Command+Option key, and then with those keys being held down, just simply click on the element that you want to bring up the Code Navigator for. So all I have to do is click, up comes the Code Navigator, and there we go.

So what is the Code Navigator actually showing us? Well, it's showing us the cascade of rules, showing us all of the rules that are applying formatting to this element or this particular item, in this case the image that we just clicked on. You can see that the selector on the bottom is the one closest to the rule. Then the selectors above it are sort of receding in the order of importance through the cascade. So by hovering over these, we get to see the actual properties being set and their values, which is really cool. It's a nice way to sort of get a summary as to what's happening here. So we can see that right now, this #mainContent .tourDescription img rule really is just applying some padding.

So if I want to change that, all I have to do is click that particular rule, and it's going to focus on that. It's going to focus on it in two places; one is within the code. You'll notice that it switches right to a split screen view, goes right to the CSS file, and jumps right down to the rule that I need. That is amazingly efficient. Rather than having to switch over to the code myself and scroll through all the rules and try to figure out which one's applying the formatting, I can do a single click, use the Code Navigator and go right to that rule. So that's really nice. So what I am going to do here is I am going to go to the last property which is padding, hit Return, or Enter, and I am going to type in Float, and I am going to float that to the left, once again, using code hinting to help me finish my coding here. So float:left;.

I am going to do a Save All, and if I switch back to Design View, I can see now the text is wrapping that. Perfect! Now, I mentioned that it was going to focus on that selector in two places. We just saw how it focused on it in the Code view, but it also focuses on it in the CSS Styles panel as well. Let me show you that. So I am going to go over to CSS Styles panel, double-click that tab to sort of expand that, and I might double- click the Files tab to collapse it. So I just want to focus on the CSS Styles panel. So you can see this text right here: Optional 4 day tour available Rating: Medium.

That's sort of still in this paragraph, and I'd like it to be on its own line and have proper spacing here. So what I am going to do is, once again, click inside that, and remember, if I am on the PC, I am going to hold my Alt key down; if I am on the Mac, I am going to hold Command+Option. I'll click to bring up the Code Navigator and again, notice here I am getting an entirely different list of rules based on the element that I have selected. So the #mainContent .tourDescription span.option is the selector that I want to choose. Now, I could go above this. If I wanted to affect all paragraphs, I could click here. So I want to affect just the selected text, so I am going to click right there.

Now, it still goes into Code view, but notice that also in the CSS Styles panel, it scrolls down, finds that particular selector and highlights it. So now, I am able to go ahead and set properties here, as well. So I am going to go ahead and add another property here, and I am going to add the Display property. I will hit Tab, and I'll do a display of block. As soon as I hit Return, I can once again go back to Design view. Now, we can see that it is indeed on its own line. It's displaying as a block-level element, and that is exactly what we want it to do. So if you're working with really complex code, and especially if you have elements that are being formatted through various rules, the Code Navigator can help you really cut through that clutter, showing you exactly which rule you need to edit and making finding that rule in your Styles, or your CSS Styles panel as simple as just a single click.

Now, if you've never used the Code Navigator, or if you've just been annoyed by the icon that keeps coming up, my advice is to take control over this really powerful feature and go ahead and add it to your workflow.

Using the Code Navigator
Video duration: 4m 47s 4h 40m Intermediate


Using the Code Navigator provides you with in-depth training on Web. Taught by James Williamson as part of the Managing CSS in Dreamweaver

please wait ...