Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
In our last movie, I showed off CSS Inspect, which allows you to preview the Box Model properties of elements while in Live view. In this movie, I want to show you another feature that I consider to be equally, if not more important, to your daily styling workflow and that's the Code Navigator. The Code Navigator gives you an easy way to access and modify your styles, from anywhere in your document, without having to know exactly which rule is controlling the element from within your styles. As your site gets more complicated, it's not unusual to have styles in various places throughout your site.
All coming together at run time to determine the final rendering. Because of this it can often be very difficult to know exactly which rule to modify to achieve the desired results. The Code Navigator can help you narrow that process down. Now, I actually know of no other feature that's been as unfairly vilified as the Code Navigator and let me show you why. I have the spotlight file here open from the 06_11 folder, and you can see I've got Live view turned off at the moment, but if I click on an element watch what happens. There's a little bit of a delay and then, that happens.
Okay, we saw that a little bit earlier in the title, but that is the Code Navigator icon. If I hover over that, it says Click the indicator to bring up the Code Navigator. Well, most the time if people don't actually use that, they get over-frustrated with that. So that when you mention the Code Navigator to them they go oh, the Code Navigator. I hate that thing. Well they hate it because it's intrusive. But just because it's intrusive doesn't mean it's bad. As a matter fact, I can click this, and we did this a little bit earlier. But I can click this and here the Code Navigator comes up. So notice what's nice about the Code Navigator is that I get a list of all-of-the selectors that are applying to the element that I'm focused on.
So I get the cascade of all the selectors. But more than that, if I hover over those cascades, I get to see the properties. So I can tell for example, if something has a margin that's causing me problems, I can begin to go through the cascade and find out where that margin is. In this case, this would be the margin causing you the issue, because it's the farthest one down the cascade. If I want to find out where an element's getting its color from, I can just continue to go up until I find Color in which case, I know it's on that particular element. Now obviously, having this icon come up every single time you click on an element isn't probably the way you want to work, because you're not always working with Styles.
So I'm going to disable this by clicking the checkbox over here on the right hand corner. At that point, let's say I click in the paragraph here. I don't see the Code Navigator icon come up anymore. If I want it, it's very easy to access. On the PC all I have to do is hold the Alt Key down and click on an element. Boom, comes right back up. If you're on a Mac you're going to hold down the Opt+Cmd Key and click and boom, it's going to come right back up. So it's very easy to bring back and that's the way it typically work. I'll turn off that indicator in any time I need it, I'll just use the keyboard shortcut to click on an element and then bring this back up again.
Okay now in our last movie, I mentioned that when you combine this with CSS Inspect, it becomes really powerful workflow for troubleshooting your pages. So let's take a look at how that works. I'm just going to click off to the site here, and I want to turn the Live view back on. Not only do we want to turn the Live view on I'm going to turn Inspect back on as well. So I've Inspect on, and to make life a little bit easier for me, I'm going to go over to my panel dock and I'm going to minimize that. So I've a little bit more room here. Now I'm doing that because I don't have quite as much screen real estate as would have if were at full resolution and you may not need to do that.
But I just want to give myself a little bit more room, because in a moment we're going to be looking at a Split Screen view of the code on one side, and the Live view on the other. Alright so as I hover over elements again I'm trying to find the culprit for the spacing between these two, that's a little off and we know it's this Gerald Chow because when I hover over that, this text here I can see that it has a large amount of padding on top of it, that it frankly doesn't need. Alright so the inspector's done its job. Now it's time for the Code Navigator to do its job. So what I'm going to do is, I'm going to use my hotkey.
I'm going to hold down the Alt Key. Remember on the Mac that's going to be Cmd+Opt, and then I'm simply going to click this element. When I do that that brings up the Code Navigator, and I can begin the find the rule that has that padding. If I go down to the very first rule, the bottom rule, the last one that's being applied the div.students p. I can see that that has the padding-top of 16 pixels. That's what I want to change. Well to change it, all I have to do is click on that rule. The moment I click on it, it opens up the CSS code and it jumps right to that rule.
So I don't even have to know where in my hundreds or even thousands of lines of code exactly where that rule is. I can find that padding-top. I can go ahead and use backspace to just get rid of that. You can do Save All, and then when I click back on to Design view, I can see now that spacing issue has been resolved, and I'm just going to sort of move this over just a little bit so that the code isn't taking up quite as much room. Remember as soon as you select an element or focus on something, CSS Inspect is turned off. So every time I want to use it, I just have to go back up and turn it back on again.
Now I'm going to scroll down, and I'm going to hover over, any one of these pictures will do really, because I'm going to use my Arrow keys now. I'm going to just start arrowing back, until I get to this article spotlight, and now once again, I can use my keyboard shortcut. I can hold down the Alt Key, Cmd+Opt on the Mac, click one time and as soon as I do that I can go right here to this article#spotlight selector. I can see that it has a margin-bottom of 3 pixels applied to it. I click on that and I can change that from 3 pixels to 0.
I need it to be 0 because I need to overwrite that margin in another one. So it's not good enough to just to delete that. All I'm going to do is Save All, we'll click back into Design view, you can see that extra spacing goes away and that is fixed. So with CSS Inspect turned on, you can mouse around your file. You can then hold down the Alt Key, click on an element, find the exact selector with the property that you're looking for, click on that and jump to it directly in your code. There is no faster way of going through your files and troubleshooting layout, or typography issues or anything.
It's just a great way of working. Now CSS Inspect does not need to be turned on in order to use the Code Navigator. So I have Inspect turned off now, and if I were just doing something with like typography and I want to know what size this particular headline was, I can still just hold my Alt key down or my Cmd+Opt key, Click, find the selector that has font size applied to it. Jump right to that one and then I could modify the font size. So, CSS Inspect doesn't have to be turned on, in order to use the Code Navigator. It's just the two of them make an extremely powerful combination, when you use them together.
Get unlimited access to all courses for just $25/month.Become a member
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.
Your file was successfully uploaded.