- View Offline
- Exploring HTML5 templates in Dreamweaver
- Understanding document flow
- Using floats properly
- Resetting CSS styles
- Creating a 1-, 2-, or 3-column layout
- Deciding on a fixed width versus variable width design
- Coding layouts for HTML5 and CSS 3
- Incorporating floated elements
- Applying the faux column technique
- Using Spry widgets
- Using Multiscreen Preview
- Modifying desktop layout for tablets
- Developing smart phone layouts
Skill Level Intermediate
In the previous movie, we added the Spry Tabbed panels to the page and realized that they were existing CSS rules for which we'd have to find a fix. And now I'll show you a strategy for discovering what those are. To do this, let's go into Current mode and I want to use one of Dreamweaver's really powerful tools in conjunction with Live View, and that's Inspect mode. So if I click on the Inspect here, when I hover over any of the various elements, if I'm in Current mode, I'll be able to see exactly what's going on with the existing rules.
And I can see that here I have one rule for the mainContent li or list item that is giving me an additional margin-bottom of 0.75em and we can test to see if that is the issue by disabling the CSS property temporarily. And in fact, that's it, so that's one of the two things that we'll need to change. And I notice up here that there is the parent of the li which is the ul, and that very likely is causing my tabbed panels' labels to move over to the right because Spry uses the unordered list to create those, so let's check that out.
And here I see in fact that there is additional margin and padding being added. So if I remove the padding, that shifts it over a little bit, and if I remove the margin, that shifts it over all the way. So that's really what they should look like just from a default perspective. Now you don't of course want to go in and just disable existing properties willy-nilly. You want to go in and replace them and target them in such a way that the rules that you're replacing them with have at least the same specificity as those that are existing and impacting on your page.
So I'm going to go back to Inspect mode and then just find this first rule here. I'll click once to move out of Inspect mode, but that also locks down the CSS STYLES panel. So now let's go locate that code and I'll do that by right-clicking on the rule and then choosing Go to Code. So here are both my disabled ul and li; let's re-enable those. And I'll just click into the rule and then go over to the CSS STYLES panel and re-enable it.
Now let's do the same thing here for the ul, clicking into that ul rule, not into the disabled part because Dreamweaver can't see that but into the start of the curly brace there or just after the curly brace, and then let's re-enable those. So what we're going to do is take both of these rules, I'm going to copy them, and then paste them down and add some specific selectors, so that we can target our tabbed panels and add in the properties that we want. Command+C to copy; Ctrl+C of course on the PC, and I'll just place them right here with a Command+V; Ctrl+V.
So now, we want to target our tabbed panels and the class to do that with is called the TabbedpanelsTabGroup. So let's put in the TabbedpanelsTabGroup and I'm going to copy this ul selector here, and then paste that in front of the li and add one more space. Let me go ahead and make the changes, and then I'll show you how I came up with the TabbedpanelsTabGroup class.
Let's go ahead and set the margin and padding in the ul.TabbedpanelsTabGroup, both to 0. And for the list item in that targeted unordered list, I'm going to keep the font-size at 1em. That wasn't the problem; margin-bottom was definitely an issue, so let's change that to 0. And for the time being, let's also keep the color. I promised to show you how I came up with that concept, and the way that it's done is you use Live Code in conjunction with Live View in order to see what classes are being dynamically added by the Spry framework.
So I'm going to move over my Code window a little bit here, as soon as I can locate the selector, I'm not being cooperative, there it is, and let's go over to our tabs. And now as I scroll over of them, let me just click on one so that we can get to that exact area. Here, you can see over on the left in Live Code is that I'm actually in the Content area for the Tabbedpanels group. And if I scroll up a little bit, I can see that the ul has the class of TabbedpanelsTabGroup.
And that's the same name that I used in setting up my CSS, right there. So that's one good change and things are looking a little bit better. At this stage, we're ready to bring in the content now and start consolidating that. That'll take just a little bit of cut and paste. So I'm going to drop out of Live View and let's go back over to our first tab which is a Backpack.
And once I have selected that, and as I mentioned earlier, you move from one tab content area to another, by clicking on the Eye icon, so make sure that you are in the Content 1 or the first tab area. And now I want to select this tour description here, so I'll put my cursor right after the first heading and then click div.tourDescription from the tag selector, cut it with a Command+X; Ctrl+X on the PC. Dreamweaver has an unfortunate habit of scrolling back to the top when you remove some content from the middle of the page, so I have to scroll back down.
Now let's select Content 1 and then replace it with a Command+V; Ctrl+V, for pasting. Scroll back down, and there is our tour description under Backpack one. All right! Let's continue, move to Calm which is Content 2. And because the first tour description has now been cut, the second one shows up immediately underneath; very handy. So select div.tourDescription, cut it, and then replace the placeholder line Content 2 with a Command+V; Ctrl+V, paste.
Okay, ready to move to number three. Put your cursor right after California Hotsprings, select div.tourDescriptions, cut it, and then replace Content 3 with a paste. Final one, for Cycle. Move into the tourDescription div, select it all from the tag selector, cut it, and this time because there is no content below that, Dreamweaver does not go up.
A small blessing, thank you, and now we paste in Content 4. Okay, let's take a look at it in Live View and see how we're doing. So everything is looking pretty good; all of my content is in the right place. Wherever there's an element that was previously placed in the tour description that we no longer need and that's this top border that we see here, we already have enough separation with the tabs and this is no longer necessary. So I'm going to go ahead and just use Inspect one more time, and locate that border by hovering my cursor over the content area and then using the Left Arrow to move up the DOM and find exactly where it's defined.
And it only takes one press and we can see the border-top property being added to mainContent div.tourDescription. So I will click once to lock that in, and in this situation, there's no need to write another rule because this selector is targeted enough, it's not being used elsewhere. So I can just select border-top and then press Delete CSS Property. In the next movie, we'll customize the CSS for the Spry Tabbed panels.
Sign up for a Premium Membership to download courses for Internet-free viewing.
Watch offline with your iOS, Android, or desktop app.Start Your Free Trial
After signing up, download the course here or from the iOS/Android App.