Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Once you get passed the initial page layout and start focusing on the individual content regions, the ability to make precise edits and tweaks without negatively affecting the overall design becomes critically important. Inefficient style sheets are usually the result of an individual having difficulty in styling a specific page region. To that end, being able to accurately judge how elements are interacting with one another is crucial to writing clean and accurate styles. Live View and CSS Inspect, both of which are tools in Dreamweaver related to Dreamweaver's WebKit integration, can be of tremendous help when writing your layout styles.
WebKit is an open-source browser rendering engine used a power of multiple browsers including Google's Chrome and Apple's Safari. Dreamweaver uses WebKit to give you the ability to accurately preview and troubleshoot your designs from within Dreamweaver. In this movie, we will explore Live View, CSS Inspect, and how they can assist you when writing your styles. So, here we have the index.htm page open from the 10_10 folder and this is more or less our finished layout.
All the background images are in place, all the content is in place, and our layout looks pretty much the way that we want it to. Now, in order to properly show off Live View, CSS Inspect, and what they're capable of, I am going to give myself a little bit of extra screen real estate. I am going to do that by collapsing my panels down to icons, remember you can do that right there and then you can just go ahead and move that over to take them down further so that no labels show up and then I am going to double-click the Properties Inspector. And so now that we've got enough screen real estate to really show Live View off, I am going to go up to my document toolbar and turn Live View on.
Now, as soon as I do that our page is re-rendered using the WebKit rendering engine and as I scroll around, I am seeing the page more or less the way it would show up in the browser. Now more importantly, any of the interactive elements that you have on the page, like rollovers or if you have some Ajax-powered widgets and things like that, you will actually be able to see those working. So, notice that when I hover over my rollovers, they're working and that's true really of any of the links that I've got in my site. So, I can kind of see how all my rollovers are working.
I can test the functionality of a lot of the stuff that I have going on in my page and I can be sure that the layout is going to be reasonably close to what I should experience in most modern standards-compliant browsers. That's awesome, but there are other things that Live View allows me to do. What if I wanted to take a quick tour of my overall site and make sure that everything is looking all right? Maybe you made a one change to a specific region and you were wondering, how did that affect all of the other regions within my site? Well, if you hold down your Ctrl key and this would be the Command key on the Mac, you can click on any one of your links to actually browse to that page right within Dreamweaver.
So, it's almost like you're in-- well, actually you are within a browser within Dreamweaver. Now, at this point, this address bar right here starts to come into play. Notice that it is showing you your current location and if you continue to go around and navigate through your site, you can see I am just clicking out some pages here. Maybe learning more about specific tours, maybe you want me to go in and get some specific information about some hiking trails, or just see how this layout reacted to any changes that I might have made. The navigation bar right up here is taking all that new accounts. So now I can start hitting my Back button, go through my pages, my Forward button to keep going through my pages, and if you get to one of these pages and you are like you know, I really forgot to do something on this page or I would like to go ahead and make an edit on this page, you do have some options when you're browsing. Because right now, if I try to edit any of my code or anything, it wouldn't work because I still have my index page open.
But if I go right up here to this menu option, Live View Options, notice that I have the option to edit the Live View page in a new tab. Whatever page I am on will currently open up and now I am free to go ahead and make any edits on this page that I need. Right well, I am going to close this out and I need to get back to our index page, so the quickest way to do that is just to click right here, just like you're in a browser and click the Home button. So there we go! Okay. So, with Live View still on, I do need to make one small tweak. As I scroll down here, I notice that the Tour Spotlight, Tour Details, and this Explorer's Podcast headline. I would like those to be a little bit tighter.
There is maybe a little bit too much space between that link an that headline. So, one of the first things I would like to do is to know which of the elements on the page I need to tweak in order to make that happen. Do I need to change the margin on the headline to move it up? Do I need to change the bottom margin on this paragraph to move the headline up? Which one of those do I need to do? Well, we have a new feature in CS5 that is really, really helpful when you're trying to determine which element to modify to make a specific change. And it is this one. It is Inspect mode, or as it's referred to CSS Inspect.
When I turn this on, as I begin to mouse around my layout, I see all of the mox model properties for a specific element. Notice that if I hover over Monthly Specials for example, I see sort of an aqua teal color, a magenta color and a yellow. Let me explain those in a little bit more detail. The teal color represents the width and the height of the element. Anything that is a sort of that magenta color represents the padding and the yellow represents the margin for that. So, as you are mousing around, not only can you see who's creating the spacing between elements, but you can tell whether it's margins, padding, content regions, borders, it really gives you a nice overview of that.
Now, as you are mousing around, you may have difficulty finding the exact element that you're looking for. So, one of the tricks that you can use here is if you've moused over an element, you can use your Left Arrow to start going up the document tree to your parent elements and the Right Arrow to continue to introspect in. So, you can go back-and-forth, if you are having trouble mousing over a specific region. Now again, we're interested over here in the Spotlight region, so if I mouse over this paragraph I can see that there is a bottom margin, but it's not touching that headline.
So that's probably not it and if I go down to the headline, well, it doesn't have a top margin. Huh. So, what's causing that little extra bit of space there? Well, it's not the Tour Details link, because that doesn't have a margin either. Wait a minute. This image right over here, look at that. If I mouse over this image, I notice that it has a fair amount of bottom padding on it. As a matter of fact, that bottom padding is lining up precisely with the edge of that headline. So, what I need to do is reduce the padding in this image if I want to move that up.
What I am going to do is hold down my Alt key, that would be the Command+Option key on the Mac, and click my image to bring up the Code Navigator. I am going to go right down to this mainContent img.articleImage. Click on that. It's going to open the CSS for that up in Code View and if you don't see the rule right off the bat, you may have to scroll just a little bit to get it. There it is right there. I am going to take that top padding, top padding amount, and reduce that down to half an em. Now, when I do a Save All, go back in Design View, and turn on Inspect, now notice that the bottom margin of my paragraph and that element are butting right up against each other and that image is no longer interfering with that.
So CSS Inspect really helped us narrow down exactly which element was causing the problem and made it extremely easy to fix. So, Live View and CSS Inspect gives you powerful tools to preview and refine your design during the development process. Although there is no substitute for testing within multiple browsers, if used properly, these features will speed up your development time and help you ensure that you are writing clean efficient code.
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.