navigate site menu

Become a member and get unlimited access to every course in the library. Try it free for 7 days

Site Navigation with CSS in Dreamweaver

Site Navigation with CSS in Dreamweaver

with Joseph Lowery

 


Join Joseph Lowery in Site Navigation with CSS in Dreamweaver as he explores current design trends in site navigation and shows designers and developers how to create robust CSS-based navigation. The course shows how to convert HTML lists to graphical controls that integrate seamlessly with an existing site design, and how to build menus with a wide range of navigation options, all in standards-compliant CSS. Exercise files accompany the course.
Topics include:
  • Using icons
  • Navigating with Spry widgets
  • Styling Spry menus
  • Working with background images
  • Implementing sprites
  • Designing navigation with accessibility in mind
  • Adding drop-down menus
  • Developing graphical navigation with jQuery
  • Creating pop-out vertical navigation
  • Exploring CSS3 and HTML5 enhancements

show more

author
Joseph Lowery
subject
Web
software
Dreamweaver CS5, CS5.5
level
Intermediate
duration
3h 24m
released
Mar 22, 2011

Share this course

Ready to join? subscribe


Keep up with news, tips, and latest courses.

submit Course details submit clicked more info

Please wait...

Search the closed captioning text for this course by entering the keyword you’d like to search, or browse the closed captioning text by selecting the chapter name below and choosing the video title you’d like to review.



Introduction
Welcome
00:03Hi! I am Joe Lowery.
00:05Navigation is a critical component of almost every web site.
00:10Whether your nav menus fly out or just sit there looking pretty,
00:15they need to guide your site visitors to what they're looking for quickly and easily.
00:20This course starts by taking a look at the current trends in web site navigation,
00:25so you can get a better idea of what's possible.
00:28Then we'll explore Dreamweaver's navigation solution built with their own Spry framework.
00:35This course will also cover a variety of navigation menu techniques and go
00:39over the step-by-step instruction for crafting both horizontal and vertical navigation bars.
00:46Finally, we'll get into some leading- edge navigation techniques, including
00:51animated image menus, as well as navigation built with HTML5 and CSS3.
00:58I am ready to help you realize your site navigation goals.
Collapse this transcript
Using the exercise files
00:00If you are a Premium member of the lynda.com Online Training Library, or if
00:04you're watching this tutorial on the DVD-ROM, you have access to the exercise
00:09files used throughout this title.
00:11Naturally, the information in this course is ultimately intended to be applied
00:15to your own web pages;
00:17however, you might find it helpful to work with the supplied exercise files to
00:21practice the steps safely and without having to create your own examples.
00:26To begin using the files from the site, download them, extract them, and then
00:31store those files in a convenient location, such as your desktop.
00:35The Exercise Files folder is organized by chapter,
00:39and in every chapter it's broken down into the various videos that you'll see.
00:45Within the video chapters, there are a series of files, typically assets, css,
00:52images, and so forth, as well as a practice file to work with.
00:56In most files you'll also find a final folder,
01:00and that contains the files showing the completed lesson, which you can open up
01:05and take a look at and explore at your leisure.
01:08If you are a Monthly subscriber or Annual subscriber to lynda.com, you don't
01:12have access to the exercise files, but you can definitely follow along with
01:16your own assets.
Collapse this transcript
1. Trends in Navigation Design
Using icons in navigation
00:00The simplest form of CSS navigation is to take an unordered list of words or
00:05phrases and convert it to clickable buttons.
00:08To make it easier for site visitors to understand and remember navigation
00:12elements, many designers are integrating small images, or icons, into their nav bars.
00:18Let me show you a few examples.
00:20Here is the Narwhal Company, and as you can see in their navigation up top,
00:25they have very simple icons hand-drawn which light up and highlight when you roll over them.
00:34And if we go to a specific one, like Passport here, the icon stays lit up in that
00:42color, showing the selected page.
00:45Another one is from custom TORONTO, and here's some side navigation.
00:50Very clean, informative icons showing the various categories.
00:54When you roll over it, a highlight outlines the icons as well as the text and
01:00shows the flyout menu in a bright purple color.
01:04If you go to a specific page, you can see that they've reversed that concept to
01:08show the current page.
01:10Another approach can be seen on the Carsonified site.
01:13Carsonified is a design firm, and as we roll over the various categories up top,
01:19you can see the navigation icons appear, symbolizing each project.
01:24And let's take a look at the very first one here, Values.
01:28And again, they're choosing to reverse the colors but keep the icon showing, very
01:34clearly designating that this is the current page.
01:37Finally, here's a template from a company called Bogawat.
01:41And they have kind of a different approach to this. Rather than always having the
01:45text visible and then showing the icons on roll-over,
01:49they do the reverse.
01:50So they have icons and you can go to a certain page and click on it and
01:55then you see the text.
01:57They also are using tooltips, as you can see, using the title tag, so that you don't
02:02have to click on it in order to see what it is.
02:05All of these icon navigation techniques are very straightforward to implement
02:09and rely on the background image technique covered later in this course.
Collapse this transcript
Understanding 3D nav bars
00:00When you want your navigation to really pop off the page, what better approach
00:03than to apply a 3D look and feel?
00:06I've seen numerous examples where one or more elements of a web page appear to be
00:10in front of the other page areas.
00:13Let's take a look at a number of sites that incorporate 3D design techniques
00:17into their navigation.
00:18The first one is from a company called Mystery Tin.
00:22Here on the vertical navigation over on the left, you can see that the ribbon
00:29appears to wrap around the white rectangle that contains the navigation.
00:34And as we scroll down and hover over the various ones, that pattern is followed
00:38with a different-colored ribbon that's also a little bit shorter,
00:43ao it indicates places that you could go but not necessarily places that you're at.
00:48And if we choose one, just to see what happens when we select the page, you can
00:54see that the larger green arrow again is being applied to show that this is the
00:59current page and then everything else is back to the shorter blue arrow,
01:04but always with the appearance that it is three dimensional.
01:08This simple well-executed concept uses a sprite image to display the
01:12two different arrows.
01:13We'll cover sprites in the Navigation Techniques chapter.
01:18Now, let's take a look at another site that uses a similar 3D wrapping
01:21technique but takes it a step further.
01:24Here you can see the ribbon wrapping around the top dark-brown element,
01:29giving that 3D appearance.
01:31And the text itself seems to be pressed into the ribbon.
01:35When you interact with the menus, hovering over them, they take on a highlight color.
01:39While this page is done with simple image swapping,
01:42this could now be accomplished with enhanced CSS3 effects, like the one shown in the
01:47chapter on cutting-edge navigation.
01:50Finally, let's take a look at a menu that adds a touch of movement to the 3D approach.
01:57Here down a little bit below you can see the tabs definitely have the 3D
02:02appearance working for them.
02:03And when you hover over any of them, they move up just a tad.
02:08This could be accomplished with CSS3 transformations, which is also covered in
02:13the chapter on cutting-edge navigation.
02:16All of these 3D designs are accomplished without resorting to using the z-index
02:20property in CSS, although that is also an option.
Collapse this transcript
Understanding explanatory navigation
00:00Rather then use symbols or icons to make their navigation buttons more
00:03meaningful, some designers take a more direct approach and say 'more is more'.
00:08Here's a number of web sites that incorporate an explanatory line of text to make
00:12their intentions crystal clear.
00:15Let's start by taking a look at one of the more extreme examples in the
00:18category from Raka Creative.
00:20As you can see, each of their navigation items here goes into great detail,
00:24whether it's elaborating on what they're thinking under Studio, or really listing
00:30out their services, or their client list under Work, and then even giving specific
00:36directions under Contact.
00:38The entire navigation takes up a good fifth of the page, which is pretty extreme.
00:43Now they do not carry this approach over to other areas of their site, such as
00:48the Studio area. You can see that the navigation then breaks down into subitems
00:54and then resorts to icons showing the Services, Work, and Contact areas.
01:01Here's a more basic take on the concept where a single line of additional text
01:05helps to flesh out the keyword heading.
01:08This same technique is applied a little bit more elaborately to the link for the sites blog.
01:13In this case, this navigation explanation is visible throughout the entire site.
01:21At first glance, this site, Corporate Risk Watch, uses a similar additional
01:26single line approach, but watch what happens when you roll over any of the nav items.
01:31Here the navigation literally takes over the page, forcing you to take what
01:35they've written seriously. While the approach may be too much for some, it
01:40definitely gets the message across.
01:42Each of these sites are looking for a way to reach their audiences quickly and
01:45effectively, definitely another strategy to keep on your designers palette.
Collapse this transcript
Creating animated navigation
00:00Browser JavaScript engines keep getting faster and faster.
00:03One of the ramifications of this improvement is that an increasing number of
00:07designers are integrating JavaScript into their navigation in order to integrate
00:12a smooth animation. Let's take a look at some cool examples. This first one from
00:18the Celtic Football Club,
00:20the navigation is a little bit further down the page and actually takes the
00:23shape of these for somewhat Polaroid- looking snapshots that you see here, and
00:28that might be enough for this site, but look what happens when I roll over.
00:32They move up and an additional scribble is attached to the text there.
00:37Now the text changes according to what the navigation item is. As I move from
00:42side to side, you'll notice that not only does it ease up, but the previous
00:47navigation item bounces down.
00:51On this next page, Dragon Interactive,
00:53when I roll over the navigation I get a very smooth fade-up here.
00:58Now this is not just the swapping of images.
01:01This is actually a JavaScript routine that is fading in the opacity.
01:06You'll notice that the colors are different. On pages that are not the current
01:12one we have a nice blue, but on the existing page like the homepage here, there
01:17is a really bright yellow.
01:19This different image that we're seeing is actually a different part of a sprite
01:24that's faded in for the current page.
01:25This same technique is applied in a subtler way to their logo over in the upper-left.
01:32This next example, you're going to have to take your eyes off the kind of
01:35compelling Flash animation up top to you go and look at the navigation that we
01:39see down below here.
01:40Now the current page is indicated by a light blue bar that's hovering above
01:46it, but as I move from item to item the blue bar slides along following me, and
01:52if I move my mouse off the navigation, it goes back to the current page, and
01:56then when I move to another page it slides all the way over very quickly to
02:01that, and actually even have a little bit of a bounce to it as well.
02:05Finally, here is the example of animated graphics without a surrounding site,
02:09done by designers Aloha Tech Support.
02:11This combines big images with very smooth sliding reveals.
02:16So if I move over abstract here, urban, which was previously the currently
02:21viewed image, shows up, and then as I move along, each image is revealed in turn.
02:27And when I move off the menus, they all slide back to their original position.
02:31There's a real nice sense of movement here. As you move more quickly, you can see
02:36some of the nice shifting that goes on that gives a really solid feel to this menu.
02:42All of these examples used jQuery, a JavaScript framework or library, to
02:47achieve their effects.
02:48We'll dive deeper into just how jQuery is used to animate navigation in the
02:53"Cutting-Edge Navigation" chapter.
Collapse this transcript
2. Spry Navigation
Inserting Spry horizontal menus
00:00A number of years ago Adobe caught JavaScript framework fever and decided to
00:04release their own library of functions which they called Spry.
00:08A good number of Spry widgets were incorporated into Dreamweaver, including the Spry menu bar.
00:13The Spry menu bar is extremely easy to use and totally integrated into Dreamweaver.
00:18As such, it's a solid on-ramp to exploring the world of CSS navigation in Dreamweaver.
00:25In this video, we'll take a look at implementing a horizontal navigation bar with
00:29the original Spry menu bar widget.
00:31In another video, "Advanced Spry Menu Techniques", I'll show you how to work
00:35with the 2.0 version.
00:37So I will start with the index.html file open from the Chapter 2 exercise files.
00:43As you can see, there is no navigation currently here.
00:47Let's go into Split view, and you can see I have my div already set up with an ID
00:52for nav bar where I want that navigation to go.
00:56So let's go over to the Insert panel and from the Category list choose Spry and
01:05then scroll down until you see Spry Menu Bar and click that.
01:09Dreamweaver will ask you if you'd like a horizontal or vertical menu.
01:13In this case we want horizontal, so with that selected I'll choose OK, and the
01:19sample menu is put in.
01:21Let me pull back the Insert bar, so you could take a look at it over here in Live
01:25view. And as you can see it's a little vanilla looking, but very workable.
01:34When I scroll over it, I get subitems.
01:36If I move to a menu item that does not have subitems, the menu item itself just
01:42highlights and nothing drops down.
01:44You can also have multiple levels of subitems.
01:48So if I go over Item 3.1 here, you can see that there are sub-subitems.
01:53Now the great thing about the Spry menu bar is as I said, it's totally
01:57integrated into Dreamweaver.
01:59I am going to drop out of Live view and just go into Design view, so you can see
02:03some of the integration.
02:04If I go ahead and open up the Properties Inspector, when I have my Spry Menu Bar
02:11tab selected, I get a special Property Inspector here and this makes it really
02:16easy to work with the Spry menu bar.
02:19Each of the items that we see here can be selected, and when they're selected, if
02:23there is any subitems,
02:24they show up here, and if there is any sub- subitems, they show up in this third column.
02:29In each circumstance, when you have an item selected, the text label of that item
02:34shows up, which you can easily modify here, and you can also change the link, give
02:39it a title, even specify a target.
02:41Now the first thing we are going to do is save this page and when you do save
02:47it, Dreamweaver displays the Copy Dependent Files dialog box that shows that
02:52there are a number of files which are being inserted into your site and they're
02:57all being put into the SpryAssets folder.
03:00When we click on OK and open up the Files panel, you will see that in the site
03:06that I have defined for the exercise files there is in fact now a new SpryAssets,
03:12complete with some JavaScript, GIFs, and a little bit further on--some CSS.
03:19Those files will of course have to be uploaded when you upload the site to push it live.
03:25Let's first start out by customizing the labels.
03:29Now, you have a number of ways that you can do that.
03:31You can either do it right from Design view by selecting the label here
03:36and changing that Item 1 to Home, and I'll do Item 2 here as About and Item 3 as Process.
03:49Now you can also, if I select the Menu Bar tab, accomplish the same thing
03:55through the Property Inspector. So if I choose Item 4 and Item 4 I am going to
03:59make Contact--I will change the text of it here--and there you see that the label
04:06was changed, and of course you can also always do it in Code view.
04:10Now, you can just as easily change the subitems.
04:12Now my first item here, Home, doesn't really have any subitems, so I am going to go
04:17ahead and remove each of those by going to the Property Inspector and
04:21highlighting the item you want to remove and then clicking the Remove Menu Item
04:26button, or the Minus sign there.
04:28With every click, it removes another one, and there is a third one.
04:33Now, there are also subitems under Process, and we're going to go ahead and
04:37remove those right now.
04:42So I'll remove the 3.3, 3.2, and notice that there you have Item 3.1. Watch what
04:48happens when I go to remove that one.
04:51Dreamweaver will display an alert, informing you that this will also remove all
04:56of the children items, and asking if that's okay.
04:59In this case it is.
05:01So now we do want to add some submenu items.
05:04In this case, I am going to add some to that same menu process.
05:07I could have just changed the name of them, but I wanted to show you the technique
05:11used for adding subitem menus.
05:13So, I will go ahead and select the Spry Menu Bar tab and with Process selected,
05:21click on the Add menu Item in the second column, which will give me the submenu
05:25items, and it will first come in as an untitled item, and I am going to change
05:31that to 'Our Oil' and then press Tab. And let's add another one underneath that,
05:38and we'll change that to 'Company' and press Tab, and let's add a third item.
05:48And instead of changing it through here, you can also go in and change it in Design
05:52view, so I am going to make this one 'The Land' and then just click outside of
05:57that to cement that.
06:00If you decide that this is not in the proper order--let's say that we want to
06:03put Company last here--
06:05I'll go ahead and select the Spry menu bar again, choose Company, and press the
06:10Move Item Down widget, which will then shift it down.
06:15Now one of the more interesting things about this is we're of course building a
06:19navigation bar using an unordered list, and you can see over here in the code
06:25that I do have a list tag and each of the list items is shown.
06:28But another way to see this is if you go to the Spry menu bar Property Inspector
06:33and choose Turn Styles Off.
06:35Now it's a little hard to see because of the way that the links are styled
06:40here, but each of these, as you can see from the bullets, is an unordered list or bulleted item.
06:47Let's go back and turn those styles back on.
06:50So go ahead and save your page again.
06:53You'll find that setting up a Spry horizontal menu is dead simple, and in the
06:57"Styling Spry Menus" video, I'll show you how to change the look and feel so that
07:02it will integrate into your site.
Collapse this transcript
Styling Spry menus
00:00Inserting a Spry menu and configuring it to get the proper text in subitems is
00:04very straightforward. Styling the CSS so that the menu works with your site
00:09takes a little bit more savvy, but once you get the hang of the basic techniques
00:13you'll be surprised at how flexible Spry menus can be.
00:16So I have my index.html file open from the Chapter 2 exercise files, and we are
00:22going to start by getting our background colors to blend in more.
00:27I'm in Live view to get the best representation, and as I hover over the items,
00:32you see that we now have kind of a bright blue as the default color for the
00:36background for both the main navigation items and the subitems. And we want to
00:41change that so that both of the standard background that we see here blends in,
00:46the hover states blend in, and also the subitems work better with the site.
00:50So let's open up our CSS Styles panel, and I am going to go ahead and select the
00:55Home navigation item, just to show me which CSS styles that are related to that.
01:00And first one we want to change is ul.MenuBarHorizontal a, or anchor, and that
01:07sets the default colors for the background, and here you can see it's a light
01:11gray, the triple E of the hexadecimal value.
01:15And we want it to blend in.
01:16So I am going to go ahead and just open up the color picker and then sample
01:20the header background.
01:22Now we also want to change these hover states, and one of the things I found
01:26from working with Spry menus is that sometimes it's actually better to go ahead
01:31and switch over to the All mode rather than the Current and collapse all the
01:36other CSS rules that you may have open, but leave open the SprymenuBarHorizontal,
01:42and then you can actually page down each of the items in turn and locate various
01:48ones that are dealing with the hover states.
01:50There are a couple of those.
01:52So we'll actually go down to ul.MenuBarHorizontal a:hover, and it also covers the focus state.
02:00So we're going to change this background to a dark green background, and I'll
02:05open up the color picker, and let's just choose this dark green that's here in
02:09this olive, and we need to do the same thing for the rule below it as well.
02:15So we'll do that, and now let's check our subitems.
02:19We can see that the top items look really good in that new color and so do our subitems.
02:24Okay. Next, let's bring the text more into style alignment with the rest of the site
02:31by making the top-level navigation uppercase, changing the font family, and then
02:36we'll also modify the subnavigation.
02:39So what controls the top-level navigation look and feel is the
02:42ul.MenuBarHorizontal li, or list item.
02:46So I am actually going to open up the CSS Rule Definition dialog box by clicking
02:52Edit Rule there, go to the Type category, and we'll use the Text-transform
02:57property and set that all to Uppercase, and we'll also change the Font-family to
03:04Trebuchet MS, Arial, Helvetica, sans-serif.
03:08Now I'll click OK and you can see an instant change there.
03:12Now when I hover over About, our subitems are looking a little bit too much like
03:16the main items, so I want those to stand out and be a little bit different.
03:20So the rule for changing these, you see here where it says ul-li,
03:24that's just changing the top level, but it also changes any sublevel, unless you
03:29specify something for the sublevel itself, which is here.
03:33So we have ul.MenuBarHorizontal ul and then that pointing to that list item.
03:40Let's go ahead and just add the Text-transform property directly in
03:43the Properties pane.
03:47If you can't remember the spelling of it, you can always go into the CSS Rule
03:51Definition dialog box by clicking Edit Rule. And once we've typed in
03:55Text-transform, we can choose from the list, and we'll choose capitalize.
04:01So now our subitems are already looking a little bit different, but that's not quite enough.
04:06We really want them to stand out a little bit more,
04:09so let's add a bottom border and we'll also separate them more.
04:13So we are going to go to where the anchor tag is defined, ul.MenuBarHorizontal a,
04:21and let's add a bottom border.
04:23I am going to go ahead and just type this directly in. And we'll make it solid,
04:32kind of thick, 2 pixels, and we'll also pick up the same color that was being used
04:37as the darker color, which I have made a note of is 759B46.
04:47Okay, so that gives us a green color here.
04:50That's actually this green that we see here.
04:54So now you'll see that I do have some additional borders showing up here.
04:58I'm not sure that I want that, so let's go ahead to ul.MenuBarHorizontal ul.
05:03You can see that border there, which is kind of like a gray border, that's showing
05:07up, and that's what that double line is.
05:09Let's go ahead and just disable that, and then when we take a look at it, we have
05:13our light-green menu bar showing up there.
05:15Now, there is a bit of a overhang on the subnavigation items you can see
05:19right in that corner.
05:21We can adjust the width to take care of that.
05:24You'll remember that the list items of the submenu are controlled in this CSS
05:30rule, ul.MenuBarHorizontal ul li, and here's the width at 8.2. So, let's drop
05:37that down to just 8 ems, and now it's lining up beautifully.
05:44So if we save this page and preview it in a browser--let's use Firefox--
05:51we'll make sure that we save all of our pages.
05:53The reason this alert is coming up is because the SpryMenuBarHorizontal.css was
05:59not saved, so we'll go ahead and save that now, and now here's our subitems.
06:06Let's go to the About page, and you can see our navigation is in place here and the
06:11Process page and even the Contact page and then back to Home.
06:16As you can see, Spry menu pages are very easy to modify to whatever degree necessary.
06:21Best of all, we've really just scratched the surface of how much you can do to
06:25customize the look and feel of your Spry horizontal menus.
Collapse this transcript
Adding Spry vertical menus
00:00Spry vertical menus work exactly the same as their horizontal siblings, except
00:05they're on their side.
00:06So let's take a look at a design where Spry vertical menus fit the bill
00:10perfectly, and I'll show you some more styling techniques along the way.
00:15First, we'll take a look at the finished product. So here you see my navigation
00:19over on the left--I'll move down so you see all five items. And as I roll over each
00:24of them, the text changes color, but also the background graphic changes color.
00:29This is using a method that involves sprites, which is covered in the
00:32"Navigation Techniques" chapter.
00:34Now when I move up to my menu item that has a submenu, as indicated by the
00:39ellipsis, you can see the submenu up here is to the right with a different
00:43background, no background graphics, and the same orange hover color. Okay.
00:49So that's where we're going. Let's get started.
00:51I am going to go ahead and close out this menu, and here as our starting point
00:55is the mission.htm file, which is located in the under Exercise File/Chapter 2/02_03.
01:00Now you can see that I don't have any navigation here over on the left, and if I
01:06go into Split View, in fact I have an open nav tag.
01:10Now this is an HTML 5 tag, which is using the new nav tag, and I wanted to do
01:15that in order to show you that Spry menus work just as well on HTML5 pages as
01:20on previous versions.
01:22All right, our cursor is placed just were we want it to be.
01:24Let's go over to the Insert panel and in the Spry category,
01:29we will select Spry Menu Bar.
01:33Dreamweaver asked if we'd like to have either a horizontal or vertical menu.
01:37In this case, we want a vertical, so I'll choose that and click OK.
01:42And there is our placeholder menu.
01:44Let me open up the Properties Inspector, and you can see, with the Spry Menu
01:48Bar tab selected, I have a Custom Property Inspector that shows off all the
01:53various items and submenus.
01:55So our first task is to go ahead and customize the labels of the various menus
02:01and make sure they're working exactly right for us.
02:03Now, I can do that right from the Property Inspector. So here is my first item,
02:07which I'm going to change from Item 1 to Tours and add that ellipsis.
02:12Now you can go ahead and choose one after another.
02:17I'll do the second one this way, Mission, and you can also go ahead and select
02:23it, if you're in Design view, right from the screen there, and we'll change Item 3
02:28to Contact, and Item 4 will be Resources. And I'm going to need to add another item, Explores.
02:38So in order to do that, the easiest way is to go up and click on the Spry menu
02:42bar, select Resources down there, and then click Add menu item, and that will
02:48come in as untitled item which I can change right here in the text field. Okay.
02:56Obviously, you would go ahead and set up all your various links here.
02:59I'm not going to takes the time to do that, but you can keep the hash marks for
03:03testing and later replace those with your actual links.
03:06Now, we also have to deal with the submenu items.
03:09The first one that I want to work with is the one Contact.
03:12Now Spry puts one in the third item by default, and I want to get rid of that.
03:16So, I'll select my Spry menu bar, choose Contact, and then I'm just going to
03:22choose the last submenu item, and then select Remove menu item.
03:27I choose the last one because I know the way that Dreamweaver works here is
03:30that it will move up the list, so I'm go ahead and choose that one.
03:34Now watch what happens with item 3.1, which has other subitems.
03:38When I click the Remove button, Dreamweaver pops open a dialog and asks,
03:43are you sure you want to delete this, because it does have some sub
03:46navigation or children?
03:47In this case we do, so I click OK, and what that does is it not only removes all
03:54of the unordered list items, but it also remove a class that Dreamweaver uses
03:59called MenuBarItemSubmenu whenever there is a submenu item, and that's how
04:05Dreamweaver knows to display this right triangle that we see here.
04:09So now let's move on to our Tours section, and here you can see it's item 1.1,
04:17item 1.2, or item 1.3.
04:20Now just to show you that you can still of course work in code, I'm going to go
04:23ahead and change these directly in Code view and make this Northern California.
04:30Item 2, we'll make Central California, and Item 3, Southern California.
04:44So we have all different regions of California covered. And when I switch back
04:49to here and then go into a Live view, I now have all of my correct labels in
04:55place for my navigation, both top level and for the sub navigation, but we've got
05:00quite a bit of styling to do.
05:02Luckily, that can easily be done with Dreamweaver and CSS.
Collapse this transcript
Styling Spry vertical menus
00:00In this video, we are going to go from this inserted Spry vertical menu,
00:05which looks like this by default, to this vertical menu, which doesn't look
00:12anything like it at all.
00:14Are you up for the challenge? Let's get started.
00:17So I have now opened my mission.htm file from the Chapter 2 exercise files and
00:24we are ready to start doing some styling here.
00:26I am going to start by opening up the CSS Styles panel, and at the moment
00:32going into Current. And let's start by getting rid of this outer border that
00:37you see around here.
00:38We don't need that at all.
00:40So I'll start by just selecting one of the Spry menu items, and that will bring
00:45into current mode in number of our Spry styles.
00:47Now you'll notice that there are a couple of rules that have the same selector
00:51but different properties assigned.
00:53The Spry Styles setup as it is by default tends to do this so that it can
00:58separate certain design styles like borders and font colors and the like that
01:03you see here into one area and other more structural things like font size and
01:08margin and padding in another.
01:10Sometimes you have to look in two places to find the property that you want to modify.
01:14In this case, what we want to do is just go ahead and get rid of the border here.
01:17Now I could either delete it, or as I am going to do here, just disable it.
01:22And when I am working with Spry styles, I actually prefer to go to the All mode
01:28and use the Spry.css that I see there.
01:31It's laid out pretty logically and you can go actually from the outside of the
01:35menu in, as I like to work.
01:37So now we are going to go ahead and try to bring this menu more into keeping
01:41with the size and the look and feel that we are aiming for, and let's change
01:45the font size of the list items. And for that, we will go to ulMenuBarVertical
01:49li, and I'm going to click Edit Rule here to open up the CSS Rule Definition
01:58dialog box, and then go to the Type category, so I can choose a font family.
02:03And I will choose Georgia which is used throughout this site, and then modify the
02:07font size from 100% to 2 em.
02:11I want to show you a quick trick.
02:12When you're working with the CSS Rule Definition dialog box, if you put in the
02:16unit measure right after the value, and then press Tab, Dreamweaver will update
02:22the unit measure list for you.
02:24Okay, we are finished with that, and now as you can see here, that brings
02:27our navigation, makes it quite large. And wait until you see the subnavigation. Even bigger.
02:32We will of course address that as we go forward.
02:35Now one of the structural things that I notice is the subnavigation is
02:40overlapping the primary navigation, and I want to move that over and down,
02:45so let's attack that now. And that's going to be in the very next Rule that you
02:50see listed here, ulMenuBarVertical ul.
02:55Let's change the margin here from -5% and so forth to 0, 0, 0, 100%, which will
03:03put it to the right there. And if I try it, you can see that it is lined up just to the right.
03:09Now we also need to make some other adjustments.
03:12I'm going to change the overall width of it from 8.2 ems to 6 ems to bring that
03:17down in size a little bit.
03:19Now you won't see that change in size right away, because the font size is so large.
03:22I am also going to add a background color to it, and I want to make sure that I
03:27scrolled down enough so I can sample my tan area here. And I'll just go ahead and
03:33type in background-color, press Tab so I get my color pickers, and I can open
03:41that up and with the eyedropper sample that color.
03:45Now you will have to do this in a number of places in order to get that effect.
03:50I still want to move this menu item over just a bit,
03:53so I'll have to go to the following rule, which has the position property 'left'
03:58that you see here, and now instead of 0 I am going to make that 5 pixels
04:02instead. And once that's locked in, now you can see that there is a little bit
04:07of a separation there.
04:09Okay, so most of our structural work is done.
04:12Now, it's time to tackle the font size in the submenu.
04:16So for this, it's the rule that follows
04:19the last one we worked on, and here we want to add a couple of properties.
04:24We are going to go ahead and change the font size and bring that down pretty
04:29radically to 0.5 em.
04:33Now if I go ahead and just preview that now, you will notice that the font size
04:37has changed radically, which is great, but I still have a wrapping problem.
04:40So I am going to go ahead and use a little-known CSS property called white-space
04:46to allow me to stop that wrapping from happening.
04:49So just type in 'white-space' and then from the dropdown list, choose nowrap.
04:56So now if I take a look at it, I have Northern California, Central, and Southern--
05:01each of them in a single line.
05:03Now this is one of the other places that I need to add in that background color,
05:08so I am going to go ahead and type in 'background-color', press Tab, and once again
05:14sample from the lower-left. All right!
05:17It's time to bring in the background image and adjust the padding so that the
05:20text sits neatly on the top.
05:23And for that we are going to go down to the anchor tag, ul.MenuBarVertical a.
05:30Typically, the background image is applied to the anchor tag.
05:33So I find bringing in background images is easiest through the CSS Rule dialog box.
05:39So I am going to go up here and I am going to go ahead and just clear the
05:43default color there, so we don't have that background color. And instead we
05:47will browse for an image. And you want to make sure that you're in the proper
05:52folder, which would be 02_04 in the _images subfolder and navigate down your
05:59list until you see nav_bg.gif.
06:06We want to make sure that this doesn't repeat,
06:08so I will choose no-repeat, and we also want to position this so that it's at the left and top.
06:15Now, this background image is actually part of a sprite. I'll click OK.
06:20So now we can see our background image is coming in, but the text is
06:23obviously overlapping.
06:24So we can adjust that by changing the padding.
06:28So I'll go over to the padding rule here and change it to .25 ems for the top,
06:34.75 em for the right, .5 em for bottom, and 1.25 em for the left.
06:45When I press Tab, you can see that all of them line up.
06:49Now that we have our background image on the primary items, if I move over to
06:52the subnavigation, you can see I still have some work there.
06:57Let's go ahead and address that.
06:59Now in this case, I am actually going to have to add a rule.
07:02There is no anchor tag for subnavigation addressed here just by itself, so
07:07I'm going to right-click on my CSS rule that we are just working on, and choose Go to Code.
07:12I like to group these CSS Rules together wherever I can, and in this case it's
07:18ul.MenuBarVertical ul a, then we will do an open curly brace and a close curly
07:30brace. And we want to get rid of the background image,
07:33make sure that doesn't appear,
07:34so I'll type in background-image: URL(none).
07:45Now when I go over and click Refresh, my new tag appears in the CSS Styles panel
07:51and I can add a background color property and sample my tan background.
07:59So there's actually about three different places where you have to put that tan
08:02background in to actually make it work right.
08:05Okay, we are getting closer.
08:06Let's go ahead and close that off.
08:08Now it's time to get rid of this right arrow.
08:11You'll find that the rule for it is actually in two places, and it's located
08:16below this group of hover rules that you see here.
08:20The first one is ul.MenuBarVertical a. MenuBarItemsSubmenu, and we also want to
08:25change the one right below it.
08:27You will notice that they both have this background image property,
08:31so let's see if we can get rid of the background image properties in all of these.
08:34I am going to opt to disable these background image properties one at a time,
08:42and let's go up and do that in the previous menu as well.
08:48Okay, so that has brought us a step closer.
08:52As you can see, there's still some issues where we have the default border
08:56bottom appearing here and we want to get rid of that, and those are located
09:00in the hover state, and the rules are found just above the two we were working with.
09:05Choose the first one, which is ul.MenuBarVertical a:hover, ul.MenuBarVertical a
09:11focus, and with that chosen, we want to disable the background color, and we
09:17actually want to change the color of it, so that it uses the orange in the logo.
09:21So I will click the color icon and then go over and sample the orange.
09:27Now we need to add a couple of other properties.
09:29I mentioned that it still has that border bottom.
09:31So let's get rid of that by putting in a border-bottom, and then entering in the
09:40value of none, pressing Tab. And the final thing we need to do here is move the
09:45sprite over, and we do that by changing the background position.
09:48So I'll enter in background-position, and change that to a value of -272 pixels
09:58on the left and 0 from top and bottom.
10:03So now when we hover over it, you can see that the background is changing, but
10:06we are still losing the other image, and that can be changed by addressing the
10:11second rule that has the background color of the dark blue.
10:15Again, we will go ahead and disable that, and let's change this color to orange.
10:23You have to do the same thing to the two rules.
10:27So now when we go over them, you can see that all of our hover colors are
10:31correct, and when we go over the item with the subnavigation, we also have
10:37exactly what we are looking for, which is the orange color coming up and no
10:41background graphics.
10:43So all of these style techniques that we've applied to the vertical menu can
10:46also be applied to the horizontal one as well to create just the type of menu
10:51that you are looking for.
Collapse this transcript
Using Spry tabbed navigation
00:00The Spry Tab panels are great for consolidating a lot of content into a
00:04single area on a page,
00:06but did you know you could also use them to create your primary navigation?
00:10Let me show you how it is done, starting with the content.
00:13Now, before we get started, I do want to show you what the final project is
00:17going to look like.
00:19So here I have the mission_tab.htm file.
00:22This one is opened up from the final folder of 02_06 in Chapter 2, and here you
00:29can see that I have my primary navigation across the top and when I roll over
00:33each of them, they turn orange,
00:35a nice roll-over color.
00:37If I select one of the ones with the ellipsis, which indicates that there is a
00:41subnavigation there,
00:42subnavigation appears horizontally underneath that item, and each of these of
00:46course are selectable.
00:48And if I go to resources, there is another three items there.
00:52So this is all built from a Spry Menu tab and over the course of the next two
00:58movies I'll show you how that's done.
01:00So we will close out the final one, and now I have opened mission_tab.htm from
01:07the 02_05 folder in Chapter 2 exercise files. And as you can see, there is no
01:14navigation currently here.
01:15By going to Split view, you can see the nav tag--
01:19this is an HTML5 page--where the navigation is intended to go.
01:23So I have got my cursor right there, and let's go over to the Insert panel, and
01:29from the Spry category, and near the bottom of the Spry category, you will see
01:35the Spry Tabbed Panels object.
01:38I click on that once to insert it, and Dreamweaver puts in two placeholder tabs,
01:44and they work just as you would expect them to.
01:47When Tab 1 is clicked, you see the content for that panel with the placeholder
01:51text saying Content 1.
01:53When Tab 2 is clicked on, the placeholder Content 2 appears.
01:58So you may recall I had five different top-level options in my navigation, so I
02:04want to add additional tabs for that.
02:07The easiest way to do that is to open up the Property Inspector. And I will drop
02:11out of Live view, so that I can select the Spry Tabbed Panels tab up here, which
02:16will make the Tab Panels Property Inspector appear down below.
02:20So I'll just select Tab 2 here, so that I can quickly add three panels by
02:25clicking the Add Panel button three times. And as you can see, all five tabs
02:31are listed up top here.
02:33So the first thing we want to do is change the headings for each of these so
02:38that they correspond to our links.
02:41So I'll click on the eye icon there, which is used to display the content for a
02:47particular tab, and I do that so I can easily go in and just select the Tab 1
02:53entry there and change that to Tours and put in an ellipsis.
02:58Now let's go to Tab 2, and again I'll click on the eye icon and change Tab 2
03:05label to Mission. Tab 3 becomes Contact; Tab 4, Resources.
03:19Resources is also one that has subnavigation,
03:21so we will add another ellipsis. And the final one is Tab 5, Explores.
03:27So we now finished all of the top- level navigation, but let's go over and take
03:34a look in the code.
03:35I want to show you an accessibility feature that you can implement pretty easily.
03:40Dreamweaver puts in a tabindex attribute in each of the list items of that are
03:45used in the Tab menus.
03:46Tabindex is an attribute that is used by those who are using the keyboard to navigate links.
03:52Tabindex takes numeric values and the lowered values are tabbed to first, and
03:59then sequentially after that.
04:01So right now they're all set at 0,
04:03so we are going to start them at 10 and then increment by 10.
04:08So Tours becomes 10, Mission becomes 20, Contact 30, Resources 40, and Explores 50.
04:19So, why do I go up by 10? Why not just 1, 2, 3, 4, 5?
04:22Well, sometimes clients will come in and say,
04:26"Oh, we have a new navigation item and we want it to go between let's say Mission and Contact."
04:32So for that to work, I would have to change the values for a number of
04:36different tabindexes.
04:37This way, I have got some room to maneuver, and if I have a new entry, I can
04:41come in and put it in as a tabindex of 25, which would fall in between Mission and Contact.
04:47All right, we are ready to actually go on now to the Content areas, which are
04:52down below in different divs, and I'm going to continue to work in Code view here.
04:57You can of course work in Design view if you like.
05:00The first entry is going under Tours, and this is a Northern California, Central
05:05California, and Southern California--
05:08three different entries.
05:09So I will go ahead and just start typing that.
05:14Now, we want these to be separated by bullets.
05:17Bullets are a special character, and if you know what the character entity is,
05:21either in its numeric or name configuration, you can go ahead and enter that.
05:26If you don't, go up to Insert > HTML > Special Characters > Other, and that will
05:37open up the Insert Other Character dialog box, where you will see the bullet
05:41on the last row. And I will select that, and you can see that the numeric
05:45character entity is •
05:51Now, if you were using the name character you would just put in •. Let's click OK.
05:59Dreamweaver will tell you that these special characters may not appear in all
06:03browsers if the document doesn't use a Latin1 encoding.
06:06You can go ahead and click OK there.
06:09So there's our character entity.
06:11We will add another space and type in 'Central California', and this time rather
06:17than look that up again, I am just going to go ahead and copy the character
06:21entity and the two spaces on either side and paste that in and the final one,
06:27which is Southern California.
06:31Let's see how that is looking up here.
06:35In Design view, I'll go to Tours and click on the eye icon, and there you can see
06:42it all kind of lined up.
06:44That's looking pretty good. Now, we do want to go ahead and turn these into links,
06:47so let's go back down to the code where that is selected, and I'll choose
06:56Northern California,
06:57make sure not to get the bullet, and then go ahead in the Property Inspector
07:02and put in nocal.htm.
07:04Let's highlight 'Central California' and we will make that 'centcal.htm' and of
07:15course the final one is going to be socal.htm.
07:23Okay, so we have all of our links made now for that area.
07:27Let's take a look. And there you can see using the standard blue links.
07:31Now notice that even though this is a unordered list, we didn't have to go
07:35through any CSS configuration in order to make the bullets disappear in the
07:39unordered list, and that's because a Spry already has them handled because this
07:44top series of links is unordered list.
07:47Okay, so we are ready to go on to Mission here, and the Mission content which you
07:52will find down below,
07:54we are going to go ahead and just remove because that does not
07:57have subnavigation,
07:59nor does the next one, number 3, which corresponds to Contact.
08:04The fourth one, which is Resources, does,
08:07so, I am going to go ahead and select that. And these three items are maps, and
08:14again we have our Bullet.
08:15Now I still have it on my clipboard because I copied it earlier,
08:18so I am going to go ahead and paste that in.
08:21Conditions is the second one--
08:24again with the bullet. And the final entry is Equipment.
08:31Now let's click Refresh, and now I can go ahead and select Maps and add in my link,
08:37maps.htm, conditions.htm, and finally equipment.htm.
08:52Okay, so let's head back to Design view and go into Live view, and now you can
08:57see the subnavigation is in place for our tabs.
09:02I can go to Mission and have no sub navigation, Contact, no subnavigation.
09:06Resources, I do have my three items.
09:08Now, Explores I still have one left so let's go back to Split view and remove that.
09:16Let's save our page and come back to Design view and double-check that last one. Looking good now.
09:22The first part of the transformation is now complete with all the
09:25site-specific HTML in place.
09:27You are now ready to style the Tab panel to match the look and feel of the site.
Collapse this transcript
Styling Spry tabbed menus
00:00Transforming Spry menu tabs from their default state to one that fits your site
00:05requires modifying existing CSS rules and adding some new ones.
00:10Let's start by reconfiguring the primary navigation labels.
00:14So to do that, I am going to go into Live view and then open up the CSS Styles panel.
00:21In this case, I am going to work in the All mode, which I find to be easier when
00:26you're working with Spry CSS.
00:29So the first rule that we are going to work with is one directed at the Tabbed
00:33Panels Tab Selector, and the first thing we are going to do is to go in and
00:38change the font family, which I find a little bit easier to do through the CSS
00:43Rule Definition dialog box, which you can open up by clicking Edit Rule.
00:48So here in the Type category, we will choose Font-family and go down to
00:53Trebuchet MS, Arial, Helvetica, sans-serif.
00:57Now we also want to increase the size here, bring it a little bit more than
01:00doubling it, going from 0.7 em to 1.5 ems. And I also want to make sure that all
01:07the entries are lowercase,
01:08so we will use the Text-transform property here and set that to lowercase.
01:13The next thing I want to do is add a wee bit of air in the type, so that I can
01:18increase the letter spacing, and that's found under the Block category, and
01:23let's just bring that in at 0.1 em, and that will differentiate it a little bit
01:28from the text around it.
01:30The next thing we want to change is the padding.
01:33You do this through the Box category.
01:36Now the default padding for tabbed menus is 4 pixels on the top and bottom and
01:4210 pixels on the right and left.
01:44I am going to change the right and left values and increase that from 10 pixels to 25,
01:51just to give a little bit more distance between each of the items.
01:55Now, there still are a couple of changes to make.
01:57We have to modify the borders, for example.
02:00I want to get rid of three out of the four borders here.
02:04One thing I have found, it is actually easier to do this in the Properties panel.
02:08So let's go ahead and click OK here, and here you can see some of my text
02:13changes have already taken effect.
02:15But I want to go ahead and get rid of border-bottom--
02:16I am just going to disable that for the moment--
02:19border-left. I do want border-right to stay so we'll keep that and then
02:24let's disable border-top.
02:26So now I will just have one line separating my entries on the right.
02:30Now, I also want make sure that the background color matches the background of the
02:34site, which is white.
02:35So I am going to go ahead and change the background color to #FFF, which is the white.
02:40You will notice that one of the entries, the one that is open, still maintains
02:46its background color, and we are going to change that next. That is controlled by
02:49TabbedPanelsTabSelected.
02:52So if we go there and change the background color also to white, and let's get
02:59rid of the border-bottom here.
03:01I will disable that.
03:03Now I want to indicate that this is the selected one,
03:05so I am going to add a color.
03:06So we will choose Add Property and type in color. And for navigation, I often
03:13sample existing colors from a logo,
03:15so let's go ahead and open our color picker, and we will go over and pick this
03:20dark teal, which looks pretty good.
03:23And then the last thing I want to do is, you will notice that if I select any of
03:26these entries, when they're selected I get this outline around it.
03:30I want to get rid of that, so I am going to add another property and this is outline, none.
03:37So now we are looking okay.
03:38We have to go now and address the hover state, which is found right above selected.
03:44So I'll choose that and the background property,
03:47we can again make it white, and let's add a color.
03:53This time, let's use the orange color that's found in the logo.
03:57So we will sample that, and now when we roll over them they turn orange,
04:01looking pretty good.
04:02Now, we are ready to move on to the Content area.
04:05Here you can see that I have, when I select it, a light gray background as well as
04:10some borders around that.
04:11So we are going to go ahead and remove all of the borders, and this is all
04:15handled in the selector called TabbedPanelsContentGroup.
04:19Let me scroll down just a little bit here.
04:23So let's take all the borders away by disabling them, and again we will change
04:29that background color to white.
04:30We are getting pretty close.
04:32All we need to do now is address the subnavigation states, which you see are
04:37still in kind of their default configuration, and we also want to move
04:41things over a little bit.
04:43Let's work on the states first.
04:45To do this, we are going to need to create a couple of rules,
04:48so I am going to click on a new CSS rule in the CSS Styles panel, and this will
04:53bring it up in a compound option, which is fine, but let's go ahead and get rid
04:57of the selector that Dreamweaver has chosen for us.
05:01Instead, what I want to do is put in TabbedpanelsContent.
05:08Let me make sure that that's a class by putting a leading period there. And then
05:13we want to address the states in that.
05:15The first state is the a:link state, and then I will add a comma so I can group
05:20a couple of states.
05:21Now, I am just going to go ahead and copy this first part so I don't have to
05:24retype that and then paste that in, and the second state is the visited state.
05:32Now, we want to save this in the SpryTabbedpanels.css, click OK, and what we are
05:37going to change here is the color.
05:41Again, I am going to sample this dark teal, and we want to make sure that there
05:45is no text decoration--i.e. underline--that would appear by clicking
05:49Text-decoration>none.
05:52Click OK, so that's looking good.
05:54It all kind of relates.
05:56Now, the next rule we need to add is basically a duplicate of this but
05:59using different states.
06:00So as a shortcut, I will right-click on that entry and then choose Duplicate
06:06from the pop-up menu.
06:07Now, I am just going to go in and change the two states from a:link,
06:12we will make that a:hover, and then instead of a:visited, it will be a:active.
06:20Click OK, and that will bring the rule into my list.
06:24I can select it, and my hover color I want to change from the teal to orange.
06:29I will just resample that, and now I should have each of my links
06:35working appropriately.
06:36Everything is looking good.
06:38Now I still have to do some positioning because now you can see that under Tours, I
06:42have Northern California, which is pretty much acceptable, but it would be nicer
06:45if it were kind of lined up more with that.
06:47But the real problem is resources.
06:49When I go to resources, my sublevel is all the way over on the left.
06:53So let's address that by creating two more rules, and these will be just applied to IDs.
07:03So the first one is for the #toursSubnav ID, which I will put in, and we are going
07:11to make this a margin left.
07:13So, I will go to the Box category, deselect Same for all under Margin, and put in
07:2020 pixels for my margin left value there. Click OK.
07:25You will notice that the subnavigation did not move at all, and that's because I
07:29don't have this ID toursSubnav placed appropriately yet.
07:32I like to do the CSS rules first because that makes it easier to actually put in the IDs.
07:39All right, let's just go ahead and create one more. And in fact I am going to go
07:42ahead and do my duplicate check again.
07:45This time instead of toursSubnav, it will be resourcesSubnav, and the value for
07:55that one is going to be a whopping 476 pixels.
08:01Now, I determined these values by using the Dreamweaver Ruler, and a good amount
08:06of trial and error.
08:07So let's go in and add our IDs, so we can see our final result here.
08:11So we want to add these to the TabbedpanelsContent, and I am going to go ahead
08:16and add an ID attribute, and now you can see that I actually have the options
08:22listed for me because I have already set up these rules. So if type T for tours
08:26here, I have it on my list. I can just hit Enter and there it is.
08:31Let's go in and do the same thing for resources.
08:35I'll place my cursor right after div and hit the Spacebar, which will bring up
08:40the code hints, and I can type in an ID, hit Return, and now type R for
08:47resources. There it is.
08:48So I am going to go ahead and save the page again.
08:50Let's go to Design view. And now when I click on resources, the sublevel lines up
08:58appropriately. And if I go to tours, it is lining up over there.
09:02So the final step is to go to File, Save All Related Files, and that will make
09:08sure that all of your CSS is stored.
09:11Now, there is one last tip:
09:13when implementing this type of menu site wide, you will want to indicate the
09:17current main navigation page.
09:19You can do this pretty easily, by changing the default tab.
09:23So you will remember, of course, that we are using tabbed panels.
09:28So if I drop out of Live view and select my tab panel there and reopen the
09:33Property Inspector,
09:34there is an entry for choosing the default panel, which is set by default to the
09:39first one, which is now tours.
09:41But let's say I am on the resources page, so I can go down and choose resources.
09:46And now I want to go back to Live view. Resources is selected and all my sub
09:51menu items are visible. Pretty nifty,
09:53don't you think?
Collapse this transcript
Including Spry accordion panel menus
00:00Spry accordion panels are a cool way to hide and reveal content on demand,
00:04complete with built-in animation.
00:06In this video, I'll be begin to show you how to extend the coolness of accordion
00:10panels to your site-wide navigation.
00:13Before we start, let's take a look at the final product.
00:16Here I have index.html open from the final folder, and you can see my navigation
00:23elements over here on the left in the vertical navigation.
00:26If I go over and roll over any of them, I get a little hover color action, and
00:31when I click on any of the ones that have subnavigation, the accordion panel
00:36expands, and I see my various elements in there.
00:39If I click on another one, it works as it normally does with accordion panels,
00:45where one panel closes and another one opens.
00:47And again, I have my subnavigation available to me.
00:49Clicking on the final one, we'll close them all and take me to whatever page is linked to it.
00:56Okay, so let's get started. And now I have index.html opened from my Chapter 2 exercise files.
01:04We're going to make this a vertical navigation, so it's going in the side here.
01:08I'll go to Split view, and we're looking for div id = "sideWrapper", line 93, and
01:16put your cursor in between the opening and closing div, and then head on over to
01:20the Insert panel, choose the Spry category if you haven't already, and go down
01:27towards the bottom, and you'll find Spry Accordion.
01:30Click that once to insert it, and you'll see that Dreamweaver has put in
01:34two accordion panels.
01:35Since we are in Live view, we can go ahead and examine how they work, so I'll
01:38roll over them and you'll see that slight roll-over color change, and I click on
01:42the second one and it rolls up.
01:45Click on the first one and the second one rolls down, just as you would expect.
01:48So let's drop out of Live view and I'll open up the Properties Inspector and
01:54click on the Spry accordion panel here. And the first thing we need to do is
01:59add a couple of additional panels so that we can take care of our additional menu items.
02:04So in the Accordion Property Inspector I'll go down and select Label 2 and then
02:09click Add Panel twice, and now we're ready to change our labels.
02:14I'm just going to go up in Design view and select Label 1, and we'll make this
02:20Home. Label 2 I'm going to turn into About with an ellipsis because this has
02:25some subnavigation. So dot, dot, dot there.
02:29Label 3 is Process--again, with some subnavigation.
02:35And finally, Label 4 is Contact Us.
02:41Now all of these need to be turned into links, so I can just go up and
02:45double-click on Home and then in the Property Inspector, type in index.html, and
02:51press Tab to lock that in.
02:54Now on About, I'll go ahead and select it, and then in the Link field, we're not
02:59actually going to a separate About page.
03:01This is just being used to open up the subnavigation, so I'll just put in a hash mark here.
03:07Same deal with the Process, where I'll select that and put in a hash mark. Contact
03:13Us on the other hand,
03:14will be going to its own page, so we'll type in 'contact.html'.
03:21Now we're ready to go ahead and put in the subnavigation, so we'll take
03:25advantage of Dreamweaver's ability to show different Spry content by
03:30choosing the eye icon here.
03:32So now we have Content 2.
03:34I'm going to select that.
03:36We're actually going to use Bulleted List inside of this as the starting point
03:40for our navigation. So I'll change this to Unordered List, and Content 2, I'll
03:46change it to Our Oil.
03:49The second entry is the Land, and the final entry is Company.
03:54Again, we want these all to be links, so I'm going to go ahead and select Our
03:59Oil there, and then in the Property inspector put in oil.html. We'll select
04:06the Land and enter land.html, and then Company, the quick double-click to
04:14select, enter company.html.
04:18Now we're ready to go on to the next one, which is Process. And instead of
04:23going through that process again--no real pun intended there, but it just happens sometimes--
04:29I'll select the content and get rid of it.
04:32Let's go into Split view here.
04:34You can see that I'm in the "accordionpanelContent"></div> under the Process, so
04:38I do have a code snippet available for us.
04:41If we go to the Files panel and open up the 02_07 folder, and the Code folder
04:48underneath it, you'll see a file called process.txt. Double-click on that,
04:54and you can open it up right in Dreamweaver, and we'll select all of the code
04:58there, do a quick copy with Command+C, Ctrl+C on the PC of course, and then make
05:05sure we're in Code view and paste it in.
05:09So now if I go to Design view, I'll see that put in there as an unordered list.
05:15Working with the HTML in Spry accordion panels for navigation is definitely
05:19different from a pure unordered list approach, but it really does give you a
05:24variety of different options to choose from when it comes to site navigation,
05:29and now we're ready to begin the styling process.
Collapse this transcript
Styling Spry accordion menus
00:00When styling Spry accordion panels for navigation, you will find yourself
00:04creating more new CSS rules than modifying existing ones.
00:09But in the end, I think you'll agree it's worth the effort.
00:13So now we have our HTML in place, and as I demonstrate here in Live view, all of
00:18the accordion panels are working, showing the subnavigation, but it's
00:20definitely not styled to fit into the existing site.
00:25So let's open up our CSS Styles panel, and I will go to All mode and then expand
00:32the Spryaccordion.css file.
00:35The first thing I want to change is the Tab and Tab label that we see here.
00:40Now, initially let's just change the background color.
00:43So I'll choose AccordionPanelTab, and I am going to scroll down a little bit,
00:47so that I can see these nice green bottle caps here
00:50because I am going to sample that color. And instead of this medium gray, I'll click
00:54on the color swatch, get my eyedropper, and then go over and sample the green for the tabs.
01:02Now, why didn't that change?
01:03It's because these now have focus, and as we'll see in just a little bit, there
01:08are a couple of specific Spry rules that handle the focus state.
01:12If I take it off focus, everything turns green except for the Open panel, and we
01:17can adjust that by going to AccordionPanelOpen, AccordionPanelTab, clicking on
01:23the color swatch and sampling the panel.
01:25Now, we still have a couple of other things that I want to do with the tab
01:29in general, so let's head back there, and I am going to go ahead and make some changes here.
01:34I am going to change the Font-size, Font-weight, and Text-transform.
01:39Those properties are all handled in the CSS Rule definition box on one page. So let's go there,
01:46clicking on Edit Rule, and let's say I am going to change the Font-size to 14
01:52pixels, bring that up a little bit in space, the Font-weight, we'll make that
01:56bold, and Text-transform, we want everything to be uppercase.
02:00So the last thing I want to change is the padding, which initially is set for 2.
02:06Let's go ahead and bump that up to 6.
02:10Okay, so I will click OK.
02:11Now, you won't see the labels, because if you'll recall, they are all links now.
02:15So we're going to have to create some specific styles in order to take care of that.
02:19But before I do that, I do want to take care of this focused state that I was
02:23talking about, so we can get away from this bright blue.
02:26So if you scroll down the Spry accordion CSS panel, you'll see there are two
02:30rules that start off AccordionFocused towards the end of the list there.
02:35Select the first one and then disable the background color, and then select the
02:39second one and disable its background color.
02:42So now we have things more and more keeping with the way we want to work it,
02:46and we're ready to start adding in our CSS rules that are specific for our navigation.
02:52So I am going to go ahead and click on the New CSS Rule dialog box. And we're in
02:58the Compound option which is good, but we don't need what Dreamweaver has
03:02selected for us, so I'll press Delete to get rid of that. And we want to start
03:06to address the unordered list that's in the navigation, specifically in
03:10AccordionPanelContent.
03:12So just in case you have some other accordion panels used throughout your site,
03:17go ahead and start off your rule by targeting the navSide, which is the division
03:24that is containing the accordion panel on the navigation for this vertical menu,
03:30and then a class of AccordionPanelContent, and that will target the accordion
03:39panel of course, and then the unordered list.
03:43And again we're going to work from the outside in and make sure that the
03:47content, which is unordered list, looks more like navigation elements than an unordered list.
03:53So make sure that it's going to be saved in Spryaccordion.css so everything is
03:57together, click OK, and let's go to the Box category where we're going to zero
04:03out both padding and margins. And then go to List Style, so we can get rid of
04:10the bullets, and go to None. Click OK.
04:16So now when I open up one of the items, you can see that now my bulleted list do
04:20not have the bullets.
04:21Now, I am going to go into Split view just so we can code these a little bit
04:26more rapidly, and I can use a little copy/paste action.
04:30So the next thing I am going to do is to highlight that rule there so that I can
04:36copy it and then paste it in, and we're going to drill down a little bit, and
04:41instead of going to the ul, we'll go to the list item that's within the ul.
04:47I'll add a closing curly brace here. And now I just want to change this color
04:52here so that it's not the same green, and I am going to make that kind of a
04:57medium gray, so I'll do a color, and then choose the color swatch, and select
05:04666 here as my medium-gray color.
05:10That will give us a base color for any list item that's not a link.
05:15So now we're ready to address the links, and I am going to go ahead and
05:18select this item again, copy that, paste, and add an anchor tag here after my list item.
05:27So we're targeting the anchor tag that's within the list item,
05:31and we want to go ahead and close off that curly brace. And the property we're
05:38going to put in is a display property, and we'll set display to block.
05:43This will turn the entire list item into a clickable navigation button.
05:48We want to add a little bit of padding around that,
05:50so I am going to do a padding: 10px. We're about halfway done here.
05:56So the next rule, we'll start to address the link states.
06:00So I am going to copy this to start, and then paste that in, and let's go ahead
06:08and add a little bit more room here. That's better.
06:13So now we're going to be more specific and we'll turn the anchor tag into anchor
06:18link, and then let's copy that, paste it in, and add the second state, which is
06:27visited. Opening and closing curly brace.
06:32And here we want to just go back to our default color, which is, if you
06:38recall, 666, and let's make sure that there is no text decoration that's going to show up.
06:43So we'll put in decoration None.
06:48Now I am going to copy the entire rule, paste that in, and change the two states.
06:55We want to change 'link' to 'hover' and 'visited' to 'active'.
07:02Now, we also want to change the color, so I am going to change it from that
07:06medium gray to 000, which is black.
07:10So now we've handled the content, but we still have to work with the tabs themselves.
07:16So we have a couple of more states to do.
07:18This will still be in the same div, navSide, and instead of
07:22AccordionPanelContent, we'll go for the Class AccordionPanelTab. And we're looking
07:32for the a:link state here. And as before, I can copy the bulk of that and
07:40paste that in and then put in the second state which we want to control, which is visited.
07:49Within our opening and closing curly braces, we'll put in the color white.
07:56So one last rule to add in here, and that's pretty much a duplicate of this with
08:02the different states.
08:03So I am just going to go ahead and copy this entire thing, paste this in, and
08:10change 'link' to 'hover', and 'visited' to 'active'.
08:16Now I do want to make one change here, and that's because with
08:20SpryAccordionPanels whenever you hover over the Panel tab, it adds in a new
08:25class, which is AccordionPanelTabHover.
08:30So let's go ahead and add hover to our existing class name here and here.
08:35Okay, let's head back to Design view and see how we're doing.
08:39So now things are looking pretty good.
08:41We're having a little bit of issue here where I still have my underline showing
08:46up, and we can quickly address that.
08:49But otherwise, everything is looking just as I expected there.
08:53So let's go ahead and tackle the hover state here.
08:56As you might suspect, it's the last one that we worked with, where we have the
09:01AccordionPanelTabHover. And we want to add in a text-decoration: none.
09:08So I am going to save that, go back to Design view, and now in my hover
09:14states, that is all gone.
09:17Now, there's one last thing to do.
09:19As you can see, whenever I click on any of the items, including CONTACT US and
09:23HOME, the accordion panel expands to its full height.
09:27In fact, when I go to ABOUT, I am getting a lot of wasted space here, and the
09:31same thing, less true, of PROCESS because that pretty much fills it out.
09:35But we want to collapse this accordion panel, and the way you do that is back to
09:40Code, go to the Source Code, and then go all the way down to the bottom of the
09:46page where you'll see the Script icon that sets up accordion1 initially.
09:53And we're going to add in an attribute here just past where it says accordion1.
09:58Make sure that you pass the quotation marks and then enter a comma, and an open
10:04curly brace, and a space, and now we're going to use a keyword called use--code
10:09hints comes up for us where it says useFixedpanelHeights.
10:13So I'll click Return there and unfortunately this is hiding my view, but I want
10:19false. And then I am going to go ahead and set the default panel which will be
10:25the first one, so I enter a comma, and the keyword 'defaultpanel', and again my
10:32code hints pop up and Dreamweaver helps me out with a colon there, and you put 0
10:36because that is the first accordion panel. And then we close off our curly
10:41brace and we're done.
10:43So let's save this, head over to Design view, and see how it works.
10:49So as you can see, my HOME does not open up, even though it is the default panel,
10:54and when I go to ABOUT, it only opens enough for the content.
10:58Of course, you could add non- navigation content to the panels, as well as the
11:02links, to provide additional explanation as needed.
11:05You'll find that accordion panel navigation is extremely flexible.
Collapse this transcript
Advanced Spry menu techniques
00:00Spry hasn't been standing still, and the engineering team has improved on the
00:04original, with better cross-browser compatibility and enhanced flexibility.
00:09The new Spry menu 2.0 widget is available now in the Widget Browser.
00:14You access the Widget Browser by going up to the app bar and clicking on the
00:19Extension area and choosing Widget Browser.
00:24Now if you have never opened the Widget Browser, it will load and install, and if
00:28you don't have Adobe AIR installed on your system, it will install that as well.
00:32As this is a AIR application, we will need to sign in to the Adobe Exchange in
00:38order to use the Widget Browser,
00:39so I am going to go ahead and click Sign In here.
00:41So enter your username and your password and then click Sign In.
00:55And once you're signed in, you can take a look at all the widgets that are available.
00:59We are looking for one of the Spry components,
01:02so the fast way to do that is to choose Sort By > Widget Name and then enter in 'Spry'.
01:09And here you'll see the Spry Menu Bar 2.0.
01:12Go ahead and click on that and it will give you a brief review and some
01:17information about that,
01:18show you all the compatible browsers. And if you click Add to my Widgets, the
01:24license will come up. Co ahead and click Accept.
01:28There's a little informative dialog box that appears telling you that it's been
01:32added to your My Widgets and you can also pick it up in Dreamweaver.
01:36So we will click on Go to My Widgets, and now let's do a little configuration, and
01:40this is one of the really nice things about the Spry menu bar 2.0.
01:43You can configure it in any number of ways and then apply those configurations
01:48on the various sites.
01:49One of the enhancements here is that here's the standard menu as it was set up
01:54before, and you can see that the width of the submenu is preset to a fixed width.
02:00But if I choose AutoWidth, it expands to whatever the width of the top-level item is.
02:06So let's go ahead and use that as our base, and we will click on Configure so
02:11that we can fine-tune this particular preset.
02:15So there are a number of different categories to choose from, and you could start
02:18in Binding & Behavior where you could control how long it takes for each of the
02:22menu items to show and hide, but let's leave those as they are and we are going
02:26to go to Fonts now and we are going to change the Font Family to something
02:31that's better suited for my site, which is Trebuchet MS.
02:35Let's up the font size a bit from 16 to 18, and you can see the changes take
02:41place over on the right-hand side in the Live view.
02:44I am going to change the font weight to bold, and now for the submenu, which is of
02:50course all the subnavigation,
02:52let's change that font again to Trebuchet MS, Arial, Helvetica, sans-serif.
02:56We will leave the size at 14 and the weight at normal.
03:01Now, let's move on to the Menu Bar Layout, and this is where you would switch the orientation.
03:06If you had a horizontal menu bar, you would leave it set to horizontal, and if
03:10you had a vertical, you could choose that.
03:12So we are working with horizontal,
03:14so I'll leave that alone, and there is a number of different positioning elements
03:18that you can choose from.
03:19This controls the width of the sub navigation that I showed you at the beginning.
03:23I am going to change the width of this from 80 ems to 700 pixels, and my
03:31label width for the items I am going to make 40 pixels wide.
03:37Now, we have also a submenu layout, which is pretty robust.
03:42As you can see, there's lots of different types of padding and label attributes
03:46that you can work with.
03:47Let's leave that as it is, and let's go ahead and move on to the Colors section.
03:52Now I am going to go ahead and open up Menu bar Background and this color picker
03:58not quite as robust as the ones built within Dreamweaver, so you do have to
04:03know your color values, unless you're choosing from one of the ones here, and you
04:08also don't want to put in a leading hash mark.
04:11So I am just going to delete the existing color value, and I am going to put in
04:16the one that I have jotted down for my site, which would be 759B46.
04:23I am going to go ahead and copy this because I am going to need this same value
04:27for multiple other ones.
04:29Press Return in order to lock that in.
04:32Now let's go ahead and add that in to the others, and I am just going to paste
04:35that in and then press Return or Enter.
04:38We also want to address the label background and then the item background: hover.
04:45I don't want this to change.
04:46I am going to have my colors change instead.
04:50Same thing for the label background: hover.
04:54So, five changes in all to this nice rich green.
04:57Let's take a look at the Menu Bar Borders.
05:00Now there is nothing here I really want to change, but I do want to point out as
05:04we go down we have control over a first- item style and a last-item style which I
05:09think is a very nice thing because often you might have a border, let's say on
05:14the right, where you don't want to have that appear on the right of your last item,
05:19and you could use that to make a change here. And there is also similar sort of
05:24attributes and options in Submenu Borders.
05:27Okay we are pretty much done here with our basic configuration.
05:31Let's go over to the Live view side and give it a name.
05:34I am going to name this
05:36'OliveNav' and then choose Save Preset, and that will bring us back to the full
05:42preview area where we can take a look and see how everything is set up.
05:45Now of course, it's still got the default entries used here, but you can see what
05:50the style is and how that's all working.
05:53Now our widget preset is created and we are ready to go back to Dreamweaver.
05:56Now in Dreamweaver we want to insert the new widget, but I want to make sure I
06:01put it in the right place.
06:03So I am going to go ahead and open up Split view and look for line 57, where
06:08it say <div id= "navbar"> and put my cursor right in there and then open up the Insert menu.
06:16Now you could do this through your Insert panel, but the menu is right here, so
06:20let's choose Insert > Widget. And when the Widget dialog box opens up, the first
06:26list displays all the various widgets, and I'll choose the Spry menu bar 2.0.
06:32Then the second one shows the presets for whatever widget is selected. And if I
06:37click on that, I see I have the default ones as well as my custom one OliveNav.
06:43So I will select OliveNav and then click OK.
06:47This will put in a lot of code, including a lot of JavaScript.
06:52So let's go up and we'll just select the unordered list here, because this is
06:59content that we need to replace, and once that's selected, I'll make sure that
07:04only the unordered list is selected.
07:07I'll open up a file that's in my code folder called nav.txt within the 02_09
07:16folder, and here you see my navigation set up for my site, all done in unordered list.
07:24It is important that you name the ID menubar, in this case. That is one of
07:28the options that you could change in the configuration module, but I kept it the same.
07:33So let's copy that, go to index.html, and replace one menubar with another.
07:39So now let me close off the Files panel and let's go back to Design view, and
07:46here you see my navigation up and running, complete with all of the subitems
07:52exactly as I expected in the Widget Browser.
07:56Now, of course you can do a lot more custom navigation for your CSS. All the
08:01Spry menu styles are available for use in the Spry menu Basic, and the style
08:07that is embedded here,
08:09these are all the custom CSS ones, so you would make your changes here and then
08:13export that to an external style sheet.
08:16With the new Spry menu 2.0 and the Widget Browser, you can actually create and
08:21save a full range of custom configurations, one for each client, and then
08:25apply them quickly and easily with an even wider range of control and
08:29cross-browser support.
Collapse this transcript
3. Navigation Techniques
Converting lists to menus
00:00One of the most basic navigation techniques used by modern web designers is to
00:04convert an unordered or bulleted list into a menu.
00:08An unordered list is used because it's really the closest match to a navigation
00:13bar, which when you think about it is just a series of links.
00:18Let me show you how to make the conversion step by step.
00:21We'll start by opening up a blank HTML page.
00:24I am going to go ahead and save that, and let's put it in our Chapter 3, 03_01 folder.
00:34We'll call it listTomenu.html.
00:40Now, the first thing I am going to do is go ahead and insert a div tag, because
00:44quite frequently you want your navigation to be self-contained, and typically
00:49when you're creating the CSS rules for your unordered list you want to make sure
00:53that you're only affecting the unordered list that's within that particular div.
00:59So I am going to insert a div tag by going to Insert > Layout Objects > Div Tag, and
01:06this ID I am going to call nav and then click OK, and here you see how
01:12Dreamweaver inserts a little placeholder text for me.
01:15Let's go ahead and get rid of that, and now we'll put in our unordered list.
01:20So I'll go down to the Property Inspector and choose Unordered List, and then here in
01:25the first item, which is Home, hit Return or Enter and then put in Products,
01:32Services, and About Us--all very quick and easy.
01:37Now the next step is to convert this standard unordered list to a series of links.
01:41So let's double-click on Home, and in the link field of the Property Inspector
01:46put in the name of my homepage, which normally for me is index.htm.
01:53We'll double-click Products and name that products.htm.
02:00Services, of course, services.htm, and About Us will simply be about.htm.
02:13So now I have my unordered list within a specific div called nav, and I am ready
02:18to begin creating my CSS rules.
02:20So I am going to go ahead and click on <ul> here because I like working from the
02:24outside in when I'm creating these rule sets.
02:27Let's open up the CSS Styles panel where you see we have no styles defined yet.
02:33I'll create a new rule, and as you can see, Dreamweaver recognizes that I probably
02:38want to create a compound rule where I have my div listed first ,followed by the
02:43<ul>, and that's exactly what I am going to do.
02:45So we'll store this in this document only for now.
02:48I'll click OK, and the first thing I want to do is get rid of the bullets that we see there.
02:54So let's go to the List category of the CSS Rule definition dialog box, and in
03:01the List-style-type field, choose none.
03:06Click OK and the bullets are gone.
03:10The next thing we want to do is target the list item for each individual one,
03:14so I'll just put my cursor there and then choose <li> from the tag selector, and
03:20here what we are going to do is have each of the items move from a vertical list
03:24to a horizontal list, and you do that by floating all of the various items.
03:28So let's create another new rule. This is nav ul li.
03:33That's correct.
03:35Go to OK, and we want to change, in the Box category, the Float property.
03:41We are going to make everything float left.
03:43We also want to add some space in between the various items, which you can see
03:48if I click Apply here, they are just right next to each other.
03:51So let's open that up a little bit, and we'll do that by clearing the Same for
03:56all check box in the Margin, and under Margin Right, we'll add 40 pixels and then
04:04go and click Apply, and you can see the separation has already taken place there.
04:08Now the next thing I want to do is make sure that my text items are centered in
04:12my navigation button.
04:13So let's go to Block and under Text Align, choose Center. Click OK and now we are
04:21ready to move on to the anchor tag, which is the next element that we see here.
04:26So with that selected, choose New CSS Rule, and you can see how we're getting
04:34finer and finer on our selector. Click OK.
04:39Here we want to set up an interactive area for the button, so rather than making
04:45the link just the underlying portion that you see on the screen, we want to
04:49expand that so that it also takes in the other areas of the button.
04:54To do that, we need to go to the Block category and in the Display
04:58Property choose block.
05:01Now let's go ahead and put a border around our button, so we can easily identify it.
05:07So I'll go to border and we'll choose a solid border.
05:13Let's just make it one pixel wide, and let's go ahead and just give it a kind
05:19of medium gray of 666.
05:22Next, we want to increase the padding to the left and the right, and that will
05:26increase the hit area of the button.
05:29So Padding is under Box.
05:31I don't want to increase it on the top, so I'm going to deselect Same for
05:35all central, and then under Top and Bottom, I'll set 0, and in Right and Left, I
05:41am going to put 20.
05:46We click OK, and you can see how each button is now centered within a particular area.
05:52If we go into Live view and I move my cursor over it, you can see that the Hit
05:57area has expanded into the full range of the button.
06:00All that's left now is to set up the link states.
06:03So let's drop out of Live view.
06:04I am going to go ahead and put my cursor in here and then click on the anchor
06:10tag and create another new rule.
06:14In this case, we're going to actually extend what Dreamweaver has chosen for us,
06:19and we want to target the first link state, which is a:link, and then you put a
06:26comma because we're going to group that.
06:27Now I am just going to copy this first part here to avoid having to retype it,
06:32and after I've pasted it in, I add the second link state which is visited.
06:37While you might want your ordinary links to change color according to whether
06:43they've been visited or not, quite typically you don't want that to be the case
06:47for your navigation buttons.
06:48So, we'll keep these both the same, and I'll click OK.
06:53Now, let's set the text of the color to black, and let's turn off the
06:58Text-decoration, and that will define the initial state.
07:04Now we are ready to do the hover state, and let's take a little shortcut here.
07:09I'll click on the last rule that I defined and then do a right-click and choose duplicate.
07:15So now I can just go in and modify the two states and change 'link' to 'hover'
07:21and 'visited' to 'active'. Again, click OK.
07:26Now we'll select that rule in the CSS Styles panel, and this time let's
07:32change the color to red.
07:36So once I enter into Live view, you can see that I have a red color whenever I
07:41hover over the buttons.
07:43Now, from here you can add a ton of bells and whistles, from background images to
07:49JavaScripted animation, but it all starts with this basic unordered list to
07:53menu styling with CSS.
Collapse this transcript
Working with background images
00:00Straight text will only get you so far in designing navigation buttons and bars.
00:05A primary method for incorporating imagery is to use the CSS background image property.
00:11Let's first look at a basic technique that uses two images: one for the standard
00:16navigation button and another for its hover state.
00:19Before we get underway, let me show you what the final product will look like by
00:23going to this backgrounds.htm file from the Final folder in the Chapter 3
00:28exercise files, 03_02 folder.
00:31As you can see here, I have a nice gradient background, and when I roll over it I
00:35get a reverse of that and the color stays the same.
00:38Of course, you could modify the color if you wanted to.
00:41Okay, so let's go back and start converting our basic navigation bar to
00:46something with graphics.
00:47So I am going to open up the CSS Styles panel and extend my existing styles here.
00:53Now typically, when you're adding in background graphics it's going to go to the
00:57anchor tag, and the selector that controls our anchor tag here is this one, the
01:02nav ul li a. So once that's selected, I can click Edit Rule and open up the CSS
01:11Rule Definition dialog box.
01:13I find it's a little easier when you're working with background images to use
01:17this dialog box so that you can use the Browse button and all the controls are right here.
01:21So let's browse for an image, and we're going to the images folder that's
01:27in 03_02 of Chapter 3 files, and here you'll see button_bg.gif, so we'll choose that.
01:37And because we want this image to expand to fill out the space of the button
01:41no matter how big it is, we'll use the Background-repeat property and set that to repeat-X.
01:48At this point there's no need to position it using either of the
01:51Background-position property, so we'll just leave those blank and click OK.
01:56And now you can see it fills out quite nicely,
01:59but it doesn't totally bring in the full width of the image.
02:03Let me show you exactly what the image looks like.
02:05I am going to dropout of Live view for a second here and hit a couple of
02:08Returns, and then let's bring in the two images, the hover, and the standard
02:15state that we're working with.
02:17Let's expand that a little bit, so we can see the full file names there.
02:24So first, I'll bring in the button_bg. No need for putting in our alternate text here.
02:33And as you can see, that's just a small graphic, 10 pixels wide, with a
02:38two-tone color there.
02:39Let me hit Return so you can see what the next one looks like. And I'll just
02:46drag that onto the screen.
02:50And here you see the darker--it's actually an inverse of that slightly darkened.
02:55So these are the images that we're working with.
02:57As you can tell, this image is larger than what I have here, so I am going to
03:01need to expand the height of that.
03:03Let me go ahead and get rid of these two images and shorten up my nav bar there.
03:10Let's go back to our Style panel, and now we want to increase the height and
03:15actually let's go ahead and increase the width as well. And that's all handled
03:18through the li selector here.
03:21So once I have that selected, I am going to go ahead and increase the width of
03:25each list item and set it to 150 pixels.
03:31Now I also want to increase the height, but you don't actually use the
03:35Height property as you might think; instead, because these are text elements,
03:39you use line height.
03:43So that's line-height, and we'll make it the full height of the graphic, which is 32 pixels.
03:52And now you get the gradient effect.
03:54Let me go into Live view, so you can see that a little bit cleaner.
03:57So now if we want the text to stand out a little bit more, we can add a
04:01different color property to the link and visited hover states. Right now you
04:06see that it's black.
04:07Let's change that to white, and there it stands out quite a bit differently.
04:11Now let's go to the hover state, and here you see we have a red color.
04:16I think it'd be better if we stick with white and let the background change
04:19instead, so we'll go ahead and choose a new background image by clicking Edit
04:26Rule > Background category > Browse and we'll go to button_hover_bg, click Choose,
04:34and again we want this to repeat-x, and click OK.
04:39So now when we hover over it, we get a nice variation there with the buttons.
04:44Now, there is a lot of different things you can do from this stage.
04:47You can even add another background image to the ul selector to wrap all the nav
04:51buttons in a single image.
04:53To do that, you would go to the nav ul rule.
04:56So let's open up our CSS Rule Definition dialog box one more time, go to the
05:01Background category, and click Browse next to Background-image, and here we'll
05:06choose the image called fullnav.png.
05:11Now this one we definitely don't want to repeat, so I'll choose no-repeat, and I
05:16also have to give it a specific width and height.
05:19So let's go to the Box category for that.
05:22The width of this image is 672 pixels, and the height is 52.
05:31So I'll click OK, and there's my background image wrapping around all of my buttons there.
05:39We've literally just scratched the surface with what you can do with background
05:42images and navigation.
05:44Let your imagination go wild.
Collapse this transcript
Implementing sprites
00:00One technique for incorporating imagery with navigation is to use multiple
00:04graphic files--one for each link state: link visited, hover, and active.
00:10While effective, this method does require a number of file requests to the host
00:13server, which can quickly add up, increasing the bandwidth and response time.
00:18Another technique, referred to as sprites, uses a single image for all states and
00:24is accomplished with just a little CSS manipulation.
00:28Let's take a look at an example.
00:29Here I have the mission.htm file here, and as I roll over each of the main
00:36navigation items, you see that the background image, which is the star and the
00:40line, changes and the text also changes. But it's really the background image that
00:45we are looking at here. And this is a single image that is being repositioned
00:49using the CSS background position property.
00:53Let's take a look at that actual image, which I have here.
00:57Now, you will notice that this has actually three different states, and we are
01:01only using the first two so far, but as I will show you in just a moment, you can
01:05easily add the third state.
01:07You can easily develop sprite images like this one in your favorite graphics
01:11editor, such as Photoshop or Fireworks.
01:13Let's go back and take a closer look at the CSS for the link and hover.
01:18Go back to my mission.htm page and open up our CSS Styles panel, and in the
01:24SprymenuBarVertical.css file, let's go down to the anchor tag called
01:32ul.menuBarVerticalanchor. And here you see the background image, and if I open it
01:39up into the Edit Rule, you can see that it's set up using the background
01:44position elements here, setting it to left and top. And that's going to show the
01:49very first image, which is that darker green gray star that we see here. Okay.
01:56Let's take a look now at the hover state, and here you see that just a couple
01:59of rules down at ul.menuBarVertical a:hover, and it also covers the focus state as well.
02:06So, I will select that, and notice that there's not a second call for the
02:11background image here as you might suspect, but instead there is a
02:15background position.
02:17Let me see if I can open that up just a little bit, so you can see the full thing.
02:19There is the background-position property just repositioning the existing graphic.
02:25This value here is 272 pixels for the left, and how do you get that value?
02:32Well, let's go over and take a look at the actual graphic.
02:35You can actually size this up either in your graphics program, or if you don't
02:40have that handy, you can do it within Dreamweaver.
02:42So, I have my image selected and my rulers are on.
02:46I am going to pull out a guide and have that lock to the start of the image.
02:49And now as I pull out a second rule, I am going to hold down the Command key on
02:54the Mac and you would hold down the Ctrl key on the PC.
02:57And as I do it, you can see the measurement there now is at 210-225 and it goes
03:03up to the end of the first graphic, which is 272. And that's the actual
03:09measurement that I want to use, but you set it in negative, because you are going to
03:13be pushing the graphic off to left, so it will actually start right here.
03:17So, that's why the orange shows up on hover.
03:20So, we can use the same technique to set up a third state.
03:24I am going to go ahead and bring my guide over and hold down my Command key
03:30so I see at the end here, it's 540 pixels. So we see that it has a measurement of
03:35544 pixels, so we'll use -544 pixels to position it for the third state.
03:43Let's switch back to our mission.htm file, and what we want to do is set it up so
03:48that since we are on the mission page that the Mission navigation item is shown
03:53as selected using that third section of the sprite.
03:57So, we are going to create a new rule, and this will be a Compound rule, and
04:05again, we are going to target the ul.MenuBarVertical class, then look for the
04:14list item and the anchor tag.
04:17Now, I am going to add an additional class to this to indicate that it is the
04:21currently selected page.
04:22I will just call that current and click OK.
04:27And we go to the Background category and in the Background-position, we choose -544.
04:35Now I am going to go ahead and put in a 0 here to avoid problems with some browsers.
04:41So, the other thing I want to do in this new rule is change the color for the
04:45type to match that background image, which is a medium gray of 666.
04:51So, with that done, let's go ahead and click OK, and the next step is to add that
04:57class that we talked about to the Mission tag here.
05:01So, I'll go into the Split view, close off the panel.
05:05Let's go ahead and click on that to bring that in to view, and we want to add
05:09this as a class here.
05:11Now, you can use multiple classes in Dreamweaver, so I am just going to type a
05:16space and add a new class of current.
05:20And you can see as I start to type it, Dreamweaver uses code hints to pinpoint
05:25the exact one I am looking for.
05:26So I will go ahead and just hit Return.
05:29And let's flip back to Design view now, and because we are in Live view, you can
05:33see it's already been updated.
05:35I now have my third state showing with both text and graphics. Thanks to the CSS
05:42Background-position property, integrating different sprite positions into your
05:47navigation states is a very clean, and dare I say refreshing, approach.
Collapse this transcript
Setting up adjustable backgrounds
00:00One of the most popular types of navigation buttons are those that use
00:03rounded corners--either completely surrounding the button or just on the top, as with tabs.
00:09If all the buttons were the same length in your navigation, you could simply use
00:13a single background image.
00:15However, the text in navigation buttons often varies in length, from the four-
00:19character home to a comparatively lengthy goods and services.
00:23A solution for this problem, called the Sliding Door technique, was developed by
00:27Douglas Bowman for A List Apart back in the stone age of the web, around 2003.
00:33The Sliding Door technique separates the button image into two parts, like this,
00:40one part contains the left corner and most of the expanse of the button and the
00:44other part contains just the right corner.
00:48Because the first part is set as the background image of the navigation button,
00:53it only displays as much of the graphic as needed to display the text and merges
00:58seamlessly with the second part to form a single navigation button.
01:03Now, the earliest incarnation of the Sliding Door technique used two different images.
01:08More recently, it has been updated to use sprites, and that's exactly what I
01:12am about to show you.
01:14So here we have slidingDoors.htm from the Chapter 3 exercise files in the 03_04
01:22folder, and let me just go into Live view for a quick second.
01:25So you can see it's a really basic navigation bar with just basically
01:29hover states in it.
01:31And what we're going to do is we are going to use a single image that has both
01:36the standard link states as well as the hover states in it in a sprite format.
01:42So you will see that there are actually four parts to this one big sprite here.
01:46In order to assign the background graphics appropriately, you need to add
01:50another level of markup to your unordered list.
01:54Instead of just having an unordered list where we have the list items and anchor
01:59tag and then the text,
02:01we need to put a span tag around the text.
02:04So that's done pretty easily.
02:05If you go into Split view or Code view and select the text, then press
02:10Command+T or Ctrl+T, that will open the Quick Tag Editor in Wrapper mode.
02:16And just type in 'span' and press Return or Enter and Dreamweaver will wrap the
02:22selected text with a span tag.
02:24So let's do that for each of these/
02:25Command+T or Ctrl+T > span, and let's select About Us, so we get all of that, and
02:37then Command+T or Ctrl+T one more time to open the Quick Tag Editor in Wrap
02:41mode, and now we have spans for all of our list items.
02:46Okay, let's go back to Design mode here, and I will go over and open up the CSS Styles panel.
02:53As I have stated before in this course, most of the time you're putting your
02:56background graphics onto the anchor tag.
02:58So I will go ahead and select #nav ul li a, and we're going to use as a
03:03background graphic this section here, so that will form the right edge of
03:08the standard state.
03:09I'll go to Edit Rule and open up my CSS Rule Definition dialog box so I can
03:17quickly go to the Browse function here in the Background category, and I'll
03:22choose tab.png, which is our Sprite image. Click Choose.
03:27Now, we don't want this to repeat.
03:28So under the Background-repeat option, you choose no-repeat and
03:33background-position is critical here.
03:35So on the X axis, we will go to the right, and on the Y axis, we will enter in
03:42-140. And that will move the sprite image up so that the top of the
03:48right-hand side is targeted.
03:50Click OK, and there is a right edge of our buttons.
03:54So I do want to show you how I got that measurement.
03:57I have the rule on here and my first guide is locked down to the top of the image.
04:03Now, if I pull out another guide and hold down the Command key or Ctrl key, I
04:08can get an ongoing output of measurements, and you can see as I get to the top
04:12here, it is really at 140.
04:16So that value that you see there at 140 pixels you need to set negative so you
04:21can shift up the sprite to the right position.
04:25Okay, let's go back to our slidingDoors.htm file, and now we are going to
04:29go ahead and put in a new rule so that we can add a background image for
04:32the left-hand side.
04:33Well, this new rule goes to the Span tag.
04:38It is #nav ul li a span, and we will save it again in this document.
04:45So now we will go to the Background category and browse and in our Images
04:51folder, choose tab.png. Make sure we set no-repeat and then the position, we
04:57want to go to the left and the top.
05:00Now to make sure that this background is applied throughout the length of the
05:03text, we need to go to the Block category and choose Display > block.
05:08There is a little bit of padding that we will need to add.
05:13I will go to the Box category and under padding, deselect Same for all, and this
05:19is just to get the text to line up properly within our image.
05:22So we have 10 pixels at top, 15 on the right, 0 at bottom, and 30 on the left.
05:33All right, let's click OK, and now you see our full buttons there, and the
05:38hover states are all active, but we want to change the background, also for the hover state.
05:43So let's go over to the hover state that we see here, and we will add a
05:49background position property.
05:50There is no need to add a background image property here because that is
05:57already in place, and now we will be going to the second tab on the right, which
06:05was the one closest to the bottom and that is positioned on the X axis at right
06:09and 210 pixels down.
06:13So that handles the hover state on the right-hand side, and as you can see, when I
06:17hover over it, the right cap shifts and that's fine.
06:20But we need to do the same thing for the left, and that will require a new rule,
06:28and this will be a Compound rule, #nav ul li a:hover.
06:35So we are working with the hover states here, and we are targeting the span tag
06:39which if you recall that's where we put the background image initially for the
06:43sprite. And let's do that for the active state as well.
06:47So I will just go ahead and copy this and paste it in and then change hover to active.
06:58I will click OK, go to the Background category, and choose left, and this time we
07:07are only going down to 70 pixels.
07:08So -70 is entered there.
07:12I'll click OK, so now the entire button shifts seamlessly, and of course we
07:18could do things like changing the text color and so forth.
07:20Now I did want to show you in the code that there are a few adjustments, a.k.a.
07:28hacks and filters, that we need to put in an order to make sure that this work
07:32properly cross-browser.
07:34Now the first one addresses the anchor tag, and this just removes a little extra
07:39side padding in Internet Explorer by setting that to overflow visible.
07:44There is a specific way of targeting Firefox by using this construction of
07:50anchor::, and then putting in a Mozilla- specific property and setting the border
07:57to none, which handles the extra padding there.
08:00Now Safari and Google Chrome also have some issues, and this is how you address them.
08:05So you can use these three adjustments in all of your sites whenever you are
08:09using the Sliding Door technique and just forget that they're there because
08:13they'll handle all of these problems automatically.
08:18Now one thing I want to point out is the flexibility of the Sliding Door technique.
08:22Let me close off the CSS Styles panel and we'll go to Split mode, close that
08:28down just a bit, so we get to see it.
08:30Now if I go to Products and let's say that the client has decided to redo his
08:35navigation and they are going to group Products and Services together, so we'll
08:40put Products and Services. And instead of a Services page there, they want to
08:44make that a Contact page.
08:46So we will change the a tag, and we will change the label.
08:52Now when go back to Design view, we will notice my Sliding Door button works
08:56perfectly--even with this longer text-- and I can easily shift things around.
09:00It who keeps it very, very flexible.
Collapse this transcript
Designing accessible navigation
00:00Making your web site accessible is not only the right thing to do, but for many
00:03sites, it's the law.
00:05You can help those using assistive technology navigate around your site by
00:09following a few simple practices.
00:12First, you need to make sure that your navigation is available under all
00:15conditions, including the lack of CSS.
00:18Basing your site navigation on an unordered list is ideal for this.
00:22You can verify its accessibility with a simple Dreamweaver technique.
00:26So here I have opened a mission.htm from the Chapter 3 exercise files, in the 03_05 folder.
00:33As you can see, we have our navigation showing here.
00:36I am going go ahead and bring up the Style Rendering toolbar by right-clicking
00:41on any of the other toolbars and choosing Style Rendering. And right in the dead
00:46center there is the toggle for displaying the CSS styles.
00:49It's currently pressed in, or is on.
00:52So let's turn that off, and now you can see what people would see if they
00:56didn't have CSS enabled.
00:58Even though this is a Spry menu bar, it's a nice list of links, including an
01:03indented list for the subnavigation. And this particular page happens to have
01:08additional quick nav down below, which is also set up as an unordered list.
01:12I'll toggle the CSS back on.
01:15Well of course it's better for you as a designer for those folks to view your
01:19pages the way you intend them with the CSS to meet accessibility standards
01:24you'll need to make sure that it still works even without CSS.
01:28Another important check is to make sure you're supporting the focus state.
01:32Focus is similar to active but subtly different.
01:36The active state is triggered when the mouse button is down, when a link is
01:40clicked in other words.
01:42Now this also gives the link of focus until the user clicks elsewhere on the page.
01:48However, if a site visitor is using the keyboard for navigation by pressing Tab
01:52to move forward through the links and Shift+Tab to move backwards, a link can
01:57have focus, meaning that the user has tabbed into it but not be active.
02:02It will activate when the user presses Enter or Return.
02:06So it's considered a best accessibility practice to include the focus states in your CSS.
02:12Another technique which is gaining traction among designers is the inclusion of
02:17a list of quick navigation links at the top of the page.
02:20This is an enhancement on the skip navigation technique, which allows folks using
02:24screen readers to jump over the navigation to get right to the main content.
02:29This new technique allows users to move immediately to multiple key areas, such
02:34as your navigation, your content, and even your footers.
02:37Let's take a look at how it works. So I am going to go into Split view here and
02:42put my cursor right after the body tag, create a new line, and I'm going to go
02:47ahead and put in an unordered list.
02:49I'm going to use a shortcut by bringing open the Property Inspector here and
02:52clicking Refresh, and that will allow me to actually set up an unordered list by
02:57just clicking the button here--quick shortcut there to avoid having to write all
03:01that code. But now I am going to put in the anchor tag with an href that will be
03:07set to the ID, main content, which is indicated by a #mainContent.
03:10I am going to go ahead and add in an access key, and we'll make this p, for page,
03:19and we'll give it a title, which will be 'Skip to page content'.
03:26Now eventually this will be placed off screen so that visitors not using
03:31assistive technology won't see it, but those who are will encounter it initially
03:37and the screen reader will read "Skip to page content."
03:41So we'll close off that a tag, put in our label, which is page content, and then
03:47close off the anchor tag.
03:48All right, I'm just going to copy that, and we'll paste it once and make some changes here.
03:56So the second link will go to the navigation, so instead of mainContent, it goes
04:02to mainNav, and we'll skip to navigation.
04:10I'll change the accesskey to n, and instead of page content, we'll make that navigation.
04:17All right, let's copy that one more time, and we'll change the href to
04:25mainFooter, make the accesskey f, and say Skip to footer and change Navigation
04:36to footer of course.
04:38So two of our IDs already exist, mainContent and main Nav, and I'll show you those now.
04:44Here is in ID to mainNav, and then once we get pass the navigation, here is the
04:49section with an ID of mainContent.
04:51Now I still need to add the ID to my footer, so I am going to go ahead and
04:59scroll down to the footer area here and just click into that and then choose
05:06Footer from the tag selector. And here you can see it does not have an ID, so
05:10let's go ahead and put that attribute in.
05:12I'll type ID, hit Return, and I'm calling this mainFooter.
05:18Now if we take a look at the page in Live view, you can see my navigation is
05:25here. And if I press the Command key or Ctrl key and click on footer, it goes
05:29right down to footer.
05:30Let's go back up to the top and the other elements work similarly, so
05:35navigation, page content.
05:39Now there is an ongoing debate whether to show or hide your skip links.
05:44Many designers feel that since the main beneficiary are those using screen
05:48readers, it's okay to move them off to the side where that technology will still find them.
05:52Other usability experts point out that many folks could benefit from this
05:56navigation shortcut, especially on lengthy pages and notably on mobile devices.
06:01I am going to leave that argument to the experts and show you how you can hide
06:05the links but keep them accessible should you choose to.
06:08It's best to position the unordered list off screen, rather than use display
06:13none, which some assistive technology ignores completely.
06:17So first we'll need to go back into Split view and give an ID to my unordered
06:23list here, and this ID will be skipLinks, and now we are ready to open up the CSS
06:31Styles panel and create a new CSS rule, and it is an ID for skipLinks here.
06:38We'll click on OK, and all we're going to do is move it to the far left here.
06:43So I'll go to the Box category, deselect Margin Same for all, and in the
06:48left field, I'll make this a -2000, which will move it far over to the left, off screen.
06:56I'll click OK back to Design view and now we don't see our skipLinks, but they're
07:02still there for assistive technology.
Collapse this transcript
4. Horizontal Navigation
Looking at the project
00:00Throughout the videos in this chapter, we're going to build a horizontal
00:03navigation bar step by step.
00:05The menu will feature dropdown submenus and background graphics created using
00:09some of the methods covered in the "Navigation Techniques" chapter,
00:13so you may want review those videos if you haven't already.
00:16Let's take a look at the menu we're going to put together.
00:20Here I have the index.html file.
00:22It's located in the Chapter 04, exercise files, in the subfolder 04_01.
00:29So here we see the main nav, and as I roll over each of the elements, we have a
00:34background graphic that appears.
00:36When I roll over a main navigation item that has a subnavigation, that drops down,
00:41and then I can roll in and you can see the different highlights there.
00:46I've maintained the navigation in a separate external file that we see here.
00:51And of course, for our HTML, we're using an unordered list,
00:57all in all a nice highly usable horizontal menu with a touch of flair.
01:02Let's start working on it.
Collapse this transcript
Building up the basic HTML
00:00The first step in creating a horizontal navigation bar is to insert the top-
00:04level menu items as an unordered list.
00:07It's really no different from creating a bulleted list in the standard
00:10content area of the page.
00:12So here on my index.html file, from the Chapter 4 exercise files, you can see
00:18that there is no navigation set up here in Live view.
00:21Let's drop out of that and go Design view,
00:23and we're going to switch over to Split view for one second, so that you can
00:27see I do have a div set up here with an id of nav and that's where our
00:32unordered list will go.
00:34So I'll place the cursor there.
00:35Now I am just going to switch back over to Design view and then click on the
00:39Unordered List button down below.
00:42And here you can see in the tag selector I am within the nav div, and I have
00:47started my unordered list with my first list item.
00:49So I am going to enter in four items: Home; About, with an ellipsis; Process,
00:57also with subnavigation ellipsis; and Contact.
01:02The next step is to convert all these list items into links.
01:06It's best to do this by clicking into the item and then selecting li--short
01:10for list item--in the tag selector.
01:12This ensures that all the text will be properly selected.
01:16You want the anchor tag within the list item tag.
01:20All right, so I'll click into Home, choose li, and then put in index.html in the
01:26Link field, press Tab.
01:29In the About field, put my cursor there, choose list item.
01:33In this case we're not going to put in a actual address because there is no About page.
01:38This is being used as a trigger for the subnavigation.
01:42So we'll just put in a pound sign, or a hash mark.
01:47And the same thing for Process.
01:49Choose that list item, add in a hash mark.
01:53Contact of course is a little different.
01:55We'll choose that list item and send that to the contact.html page.
02:02Okay, our foundation is laid.
02:04Now we're ready to begin converting the list into navigation buttons.
Collapse this transcript
Displaying top-level links horizontally
00:00Once you've created your initial unordered list, it's time to begin the
00:03conversion to a series of navigation buttons.
00:06As a best practice, the first thing that I would do is create a new CSS
00:10file linked to my main source code to assure complete separation of content from presentation.
00:16With the index.html file from the Chapter 4 exercise files open, let's choose
00:21File > New and then under Page Type, select CSS and click Create.
00:30Now we'll save this file in our CSS folder, which again is located in 04_03,
00:38and name it nav.css.
00:42Okay I have saved my CSS file, and I can go ahead and close that because now the
00:47next thing I want to do is link it to my main source code. And you do that
00:51through the CSS Styles panel by going down and choosing Attach Style Sheet.
00:59We'll click Browse and again make sure you're in the css folder for the
01:04appropriate subfolder,
01:06choose nav.css, and then create that link by clicking Choose and click OK.
01:14Now you will notice up here in the Related Files I do have my nav.css.
01:19It is, however, separated from the main.css by just one JavaScript file, which
01:24is okay and I could work with that.
01:26But if you have a lot of related files, either JavaScript or other files, you
01:30might find it a little bit more difficult to find all of your various CSS files.
01:35So, one thing you can do is group them together, and this is how you do that.
01:40Go to Code. I'll select the linked file that we just put in, and I'll drag that
01:45up. Dreamweaver will scroll through all the various JavaScript functions, and
01:50then I am going to drop it right after the initial link tag that brings
01:54main.css into the document.
01:57Now, if I click Refresh, my Related Files bar shows main.css right next to nav.css.
02:05So the first rule that we are going to create will deal with the nav div itself.
02:09If I go into Live view, you can see that it's definitely not in the right place,
02:13and it's wrecking a lot of havoc with the rest of the page.
02:16So let's go into nav.css, and we'll start our first CSS rule, which will be
02:22targeting the nav ID selector there, the #nav, and I put in my curly brace.
02:30Now, let's enter in the width, which I got from the graphics program that I was
02:35using to design the navigation, and that width is 560 pixels.
02:40Now on the next line I am going to add in the padding, and we are going to put in
02:44the 50 pixels of padding at top.
02:46This is to handle that background graphic that you saw appear whenever the main
02:51nav items were hovered over.
02:53All the others can be set at zero.
02:56Next, we want our div to blend in, so I am going to add in a background color, and
03:05this is one of the things that I don't really like that much about Dreamweaver:
03:08If I choose the color to bring up the color palette, I can only sample the color
03:12palette itself or bring open the extended version.
03:15I can't go over into the Design view and sample it.
03:19So what I'll do sometimes is just choose a placeholder color, like this orange
03:24here, and then close that out with a semicolon. And once I have that, I can go over
03:30and click on the CSS Styles panel, and that will refresh, and you can see that my
03:35orange color is now put into the div.
03:37Well, if I want to change that, all I have to do is select the rule and then once
03:43I see background color there, I can click on the color picker and I can go over
03:47and sample right from the Design view.
03:51Let's go back over to code and continue entering in our Properties. So I am
03:54going to give it a height of 50 pixels and we're going to position this
04:01absolutely and put the left property at 200 pixels--
04:09again, these values came from the comp that I did--and the top property at 50 pixels.
04:18So now, if we go over and take a look at the page--let me close this down just a
04:22tad--you can see that's pretty much in the right place, and best of all, our
04:27design is no longer broken up.
04:29Next, we'll remove the bullets and any extra margin by creating a rule that
04:34targets the unordered list in the nav div.
04:38So I am going to go back to code here, and we'll start this with nav ul, put in
04:46our opening and closing curly braces there.
04:48We are going to set the margin to zero and padding to zero just to make sure
04:54that there are no surprises there.
04:57Now we also want to get rid of the bullets, and to do that we use the
05:00list-style property.
05:02You could list-style-type or just list-style and set that to none.
05:07Now, I am going to set the height of this to 1.5ems, which will correspond with the
05:16line height that we'll set in just a bit.
05:19Finally, we are going to add a border across the bottom with the border-bottom
05:25property, and that's going to be one pixel wide, solid, and the color is a value
05:32that I've picked up from my graphics program, which is #7A9E47.
05:39That concludes that rule. So if I click back into here, you can see that the
05:44bullets are now gone and I have kind of a bright-green line going across there.
05:49Now we are ready to create a rule for the list item itself, which will bring all
05:53of these onto a horizontal configuration rather than vertical.
05:56And to do that, we enter in nav ul li. As you can see, we are just basically
06:04drilling down getting more and more specific.
06:07We started out with nav, we went to nav ul, and now nav ul li.
06:15The first thing I am going to do is float everything to the left, and that will
06:18bring all the items into alignment horizontally.
06:23If I click over, you can see them appear one after another.
06:27So in order to add a little separation there, we'll put in some padding, and we
06:32want the padding to appear only on one side, so it's going to be padding right,
06:36and I am going to make this 35 pixels,
06:39though now if I click over you can see that it's starting to separate the items.
06:45Next, I want to choose the font that I'm going to be using.
06:48So I'll enter in the font property, and I want the text itself to be 1em as a size, but
06:55I want the line height--or the leading as those designers from the print trades
07:00understand--to be 1.5.
07:02So you do the font size first and then the line height size next.
07:09So it's 1em over 1.5em.
07:13You can then choose the font family, and we want to choose Arial Helvetica,
07:20sans serif here. And once that chosen, I can go ahead and hit Return. Enter in a semicolon.
07:26So this is looking a little bit better, however, I think I want to distinguish
07:30these top items a little bit more by making them all uppercase.
07:34So I am going to go in and add the text- transform property, and here we'll choose
07:44uppercase from the code hints.
07:46So the next thing I want to do is to set the width of the list item itself, and I
07:51am going to set that to 100 pixels. And then the final thing is to align
07:55everything to the left specifically.
08:01Okay, so let me close Split view here.
08:03We'll go to Design and now you can see that the unordered list is beginning to
08:06take shape as a nav bar.
08:08You are now in position to begin customizing the link states.
Collapse this transcript
Customizing the link states
00:00It's time to add a little more defined interactivity to our nav bar, including a
00:04background image that appears on hover.
00:07I now have the index.html file open from the Chapter 4 exercise files, the 04_04
00:14subfolder, and right now, the actual link that you see here, the hit region if
00:21you will, is pretty narrow.
00:23Let me turn on Inspect mode, and I will show you exactly what I'm talking about.
00:26So, if I go to the anchor tag, that's really the full width and size of the hit
00:31region. And we are going to use padding to extend the anchor tag area to be a
00:35little larger on the left and the right, and then also on the top, so we can
00:39include that background image--and even a little bit below, so we can have some
00:43separation between our top nav and subnav, and still keep the active area alive.
00:49So, let's drop out of Inspect mode, and I am going to go over to Split mode here.
00:54Now, I've got my nav.css file selected in the Related toolbar.
01:00So, let's add in that new rule, and we are going to continue to drill down.
01:03This time we will address the anchor tag.
01:06So I'll choose the first part of the selector here, copy that, and paste that
01:13in, so we have nav ul li, and we add the A or anchor tag there, and I will do my
01:19opening and closing curly braces and head back to the center, so I can add in my padding.
01:25Now, the padding will have a 60 pixels up top--and that's for that background
01:31graphi--40 pixels on the right, 15 pixels below and an equal amount on the left
01:39of 40 pixels, so that the right and the left balance.
01:42So, now if I go over and preview and go back into Inspect mode, when I hover
01:48over the link, you can see that the hit area is greatly expanded.
01:53Now, let's fine-tune our basic link and visited states to remove the
01:58underline and set the color.
02:00What you are seeing now is the CSS definition for the standard links, such
02:05as this one here in the page, and we want our navigation bar to be
02:08completely different.
02:10So, let's go back to the nav.css, and we are going to enter in two link states.
02:16The first one would be nav ul a: link and then nav ul a:visited.
02:30And here, we are going to set the basic color.
02:33I think I am going to actually change the color here to make it more sedate.
02:37We will give it a kind of a basic gray, which will be 424242, and make sure
02:44that there is no underline by turning off the text-decoration, or setting that to None.
02:53I forgot to put in the leading hash mark there for my color, so let me correct that.
02:57Now, let's go in and add in the hover state, which will be almost same rule but
03:04with different states. So I am going to go ahead and just copy that selector and
03:08then paste that in and change 'link' to 'hover' and 'visited' to 'active' and then of
03:16course put in the curly braces.
03:18Now, because I don't want my color to change, I am going to go ahead and copy
03:22these two properties and also paste those in. But we do want a background graphic to appear,
03:29so I am going to go actually over to the CSS Styles panel and put that in
03:33through here, so as to make sure that I choose the correct file.
03:36So, I have chosen the hover and active rules that you see there, and now I will
03:41go to Edit Rule, Background category, and let's browse for our image. And you want
03:47to make sure you are pulling from the 04_04 images subfolder.
03:52And the image select folder is called olive_bg.gif.
03:58Now, this is a background image that we do not want to repeat, so we will choose
04:01no-repeat, and placement wise,
04:04we want to put it on the x axis in the center and at 10 pixels, which will bring
04:12it down just a bit. Click on OK.
04:15So, now when we hover over it, our color does not change, but we do have a nice
04:19background graphic that appears, and there is no underline.
04:23So, the top navigation is done. Now you're ready to begin work on the
04:27submenu items.
Collapse this transcript
Adding drop-down menus (HTML)
00:00Just as the first step in creating the top-level navigation was to enter its
00:03HTML, the initial work on the submenu is to add additional unordered lists, each
00:09placed under its respective heading.
00:11I have the index.html file from the Chapter 04 exercise files 04_05 subfolder
00:18open and ready to work, and we are going to add in these unordered lists.
00:23I've always found that the fastest way to work with unordered lists is in Design
00:27view, and if you already have the CSS applied, to disable that.
00:31So, in order to do that was open up the Style Rendering toolbar, and you can get
00:36to it by right-clicking on any of the toolbars that you have already opened, and
00:40from the pop-up list, choose Style Rendering.
00:43I am going need to drop out of Live view, and here you see my toggle for turning
00:48CSS styles on and off is turned on currently, so let's turn that off. And now we
00:54can quickly add in our subnavigation as a secondary unordered list.
00:59So, I am going to go ahead and open up the Property Inspector here, just so we
01:02can see that in action, and after About,
01:05I will hit Return, which initially makes another list item, and then just
01:10press Tab to indent that.
01:12Now, let's enter in our new entries, which is Our Oil, The Land, and Company.
01:21And under Process, we have about five different subitems, so let's go ahead
01:25and enter those now.
01:26Again, press Return or Enter after Process and then press Tab to create the
01:32nested unordered list, and in the process is Growing, Harvesting, Milling,
01:42Bottling, and Shipping.
01:46As before, once you've entered in the text, we have to convert each of these into a Link.
01:51So, I will go through the process of selecting that, making sure that li is selected
01:55here, and then entering in the HTML address, and we will just step through the
02:03process of doing this for each of these.
02:05Of course, if you have got single words, you can just go ahead and double-click
02:12on it to select it, which is a great boon for the Process menu.
02:29Milling, bottling, and finally shipping.
02:45Now, in order to cleanly target the nested unordered list, we are going to add a
02:49couple of classes to the main level items About and Process.
02:53So, I am going to go ahead and click into About and then go into Split view,
02:59and you can see the list item here, About, and I will add in a class, and the
03:05class I am going to add in is subNav.
03:08And we want to do that also for Process.
03:10So, we got to skip down to where we find Process. Or you can just quickly in
03:14Design view select it over there, so you can locate it.
03:18And in the list item, I will enter in a class attribute, and again subNav is the class.
03:26Okay, so let's go back to Design view.
03:28I will toggle my CSS styles back on, and things have gone totally crazy.
03:35Well, luckily, we now have all of our HTML for the subnavigation items in place.
03:41The very next step is to add in the appropriate CSS to whip these crazy
03:46submenus into shape.
Collapse this transcript
Working with submenus (CSS)
00:00We are at the stage in the development of our horizontal navigation bar now
00:03where we've added the subnavigation text and it's time to start styling it.
00:09And somewhat perversely, the very first thing we need to do is hide it.
00:13So, as you can see, we have lots of problems going on here with the
00:16subnavigation, including it being outsized off to one side, and we also have
00:22the background image repeating--not to mention that it's exposed right from the outset.
00:28So, let's go over to Split view, and I have my nav.css file open.
00:34I will go down to the bottom here, and now we will create a rule that will hide
00:38the nested unordered list.
00:40So, we start off by targeting nav li.subNav, and that will select only those
00:48list items which have a class of subNav, but we want to target specifically the
00:53unordered list found under those.
00:55So, I will add in a ul there and open and close in curly brace.
01:00Now, we put in a display none property, and if I click over into Live view, it disappears.
01:09So, of course the next thing to do is to define a rule that reveals the subnav
01:13when the top navigation item--again with the class of subnav--is hovered over.
01:19So, let's add a new rule.
01:21It goes nav li class subNav.
01:26Now, we are going to put in the hover state, so we put in colon and then the
01:30hover and again the ul tag.
01:36So, we want to bring this back into view and you do that by using a display
01:40property set to block.
01:43And we want to make sure that there's no border underneath this ul, so we
01:48will type in border: none.
01:51And I also want to move over the subnavigation so that it lines up properly.
01:55If you recall, we put in a left margin of 40 pixels.
01:59We are now going to use that value again by putting in a margin-left of 40
02:04pixels and finally a 0 padding.
02:08So, let's take a look and see how things are shaping up.
02:12Well, we are getting a little bit better.
02:14Things have now a little bit more in alignment, but we still need to add a
02:19background color, so back to the nav.css, and we are going to target just the
02:26list items that are within the nested ul now.
02:30So, that's going to be nav li, class of subNav ul li, and let's shrink down the
02:41height a bit by giving each item a height of 1.2 ems.
02:45And I am going to go ahead and set a darker green background color here, and
02:54the value I am going to put in is one that I picked up from my design. So it
02:58starts off with 759B46,
03:03and let's add in some padding to separate each of the items.
03:06We will do 3 pixels from the top, 0 on the right, 3 pixels on the bottom, and 5
03:13pixels from the left.
03:16Finally, we're going to align the text to the left.
03:21Okay, one more rule that will reduce the size of the subnav items and give a
03:26nice contrasting color, and we are going to apply this to the anchor tag.
03:30So, nav li:subNav:hover ul li a. So, we will give it an initial color of white
03:48and a font size of .75em, and again zero out that padding. Okay.
03:57So let's take a look and see how things are going.
04:00Well, they look a lot more reasonable now, don't they?
04:02So, the next task is to add some proper interactivity.
Collapse this transcript
Achieving interactive submenus
00:00The almost-last piece of the puzzle is to define the subnavigation states the
00:04way we want them to look.
00:06In this case, we're going to lose the underline that you see here and go with a darker color.
00:11The key is to make sure that you set up your selectors properly.
00:15So let's open up Split view and down at the bottom of the nav.css file,
00:20we'll create a rule.
00:23And this will be #nav li.subNav.
00:26And we're going to target the anchor link state, so we go to the ul li a, for anchor,
00:35and then link state.
00:37And them I am just going to ahead and copy this first part so I don't have
00:40to retype that, add a comma as we group these selectors, paste in that, and then add visited.
00:48Okay, we're ready for our curly braces.
00:50Now let's get rid of the underline first by setting text-decoration to none.
00:58Now I want to make sure that the text of my subnavigation items is white for
01:03giving a high contrast when they first appear, and then on hover we'll change
01:07it to a darker color.
01:08So I am going to go ahead and enter in white, which I could either sample or just
01:11type in, but let's just do a sampling right now.
01:14So that's my initial link and visited states.
01:17And we'll copy this rule and paste it, and then just change the states from link
01:25to hover, and from visited to active.
01:29And now we're going to go ahead and give it a darker color instead of the white.
01:35And the color that the designer has specified is 32411B.
01:42And let's check that out now.
01:44Now you'll notice that I am still getting what appears to be an underline,
01:47but it's actually not.
01:48It's actually the background image that's appearing there.
01:51So we'll need to get rid of that.
01:54So let's go back over to our hover state and add in one final property which is background: none.
02:04Now when we click over into Live view and check it out, we just have the simple
02:08color change happening.
02:10And so I think congratulations are in order.
02:11You've completed the horizontal navigation bar. Good work!
02:15You're now ready to set up your nav bar so that the current page is indicated.
Collapse this transcript
Marking the current page
00:00Many designers, myself included, like to offer their visitors overt indicators
00:04of the current location within the site.
00:07One way of doing that is to make a recognizable change to the
00:10top-level navigation.
00:12I'll show you a technique that you can apply sitewide with minor HTML updates in
00:17a series of simple CSS rules.
00:19What we are going to do is give each page a unique identifier as well as
00:24each top-level menu item, so that when you are on a certain page, you'll see
00:29the background graphic.
00:31So, here we are with the index.html file from the Chapter 4 exercise files
00:37in the 04_08 subfolder, and the first thing we need to do is to identify this
00:43particular page that we are working with.
00:46So, this is the homepage, so I am going to go to the body tag,
00:51and I will drop out of a Live view here. And I am going to go ahead and give it an ID.
00:56So, to make sure that we don't conflict with any existing IDs, I am going
01:00to call this homePage.
01:01Let's go ahead and put in unique ids for each of the four main menu items.
01:06I will go up and select the home div there and choose the list item to make sure
01:14I have that, and then this one
01:16we are going to call homemenu.
01:19And let's do the same thing for About.
01:22I'll choose the list item there and add in an ID of aboutmenu.
01:31For Process, let's select that list item and make that processmenu.
01:37I think you can see the method to my madness here.
01:42And the final one with the list item is of course contactmenu.
01:47Now, with the HTML in place, you are ready to write out the CSS, which is
01:51basically a duplicate of an existing rule that causes the background graphic to
01:56appear on hover with different selectors.
02:00So, let's go back to Split view, and I'm going to go down to where I find my
02:06background graphic appearing here, and I am going to just copy this entire
02:09rule for the moment,
02:11move down to the very bottom of the page, and paste that in.
02:17And then I'm going to get rid of both the color and text-decoration, because
02:19don't need that; we just need the background change there.
02:23So, now let's target the anchor tag that's related to the homePage in the home menu.
02:28So, I will change this selector to pounce sign or hash mark homePage--
02:33there is my homePage id--and then a list item with an id of homemenu and 'a' for anchor tag.
02:42So, because we are on the homepage now, when I go over into Live view, you will
02:48see our background graphic up here even without hover.
02:52So, now let's go back, and it's a simple matter of copying this rule and then
02:57modifying the selector for each of the menu items, and then paste it in, and we
03:02will change homePage to the next one, which is About. And of course, we want to
03:07change homemenu to aboutmenu, and then I'll paste in another copy of that and
03:14change homePage to processPage and homemenu to processmenu.
03:24One more copy of the rule, paste it in, and change homePage to contactPage and
03:33homemenu to contactmenu.
03:36So, let's save this page, and we will go back into Design view.
03:41Now, I am going to go ahead and turn on Follow Links Continuously so that
03:45we can try this out.
03:46I have taken the liberty of copying our nav bar code to the three other main
03:51pages in the site and added the necessary IDs to the body tag for each.
03:55So, we are ready to take this current page update for spin. I have Home here.
03:59If I click and go to the About page, you can see that I have the background
04:03graphic, even when I move off hover. Same thing with Process and same thing with Contact.
04:09Let's head back to Home and everything seems to be working perfectly.
04:15The beauty of this technique is that you could put your navigation in an include
04:19or in a Dreamweaver template and it would work just as well.
Collapse this transcript
5. Vertical Navigation
Looking at the project
00:00In this chapter we're going to build a vertical navigation bar from the ground up.
00:04The menu will have a flyout submenu and changing background graphics via the
00:09sprite technique, which was covered in the "Navigation Techniques" chapter.
00:13Let's take a tour of the completed vertical menu.
00:17You can see my vertical menu here over in the side area.
00:21When I hover over any of the elements, the text changes color and the background
00:26graphic changes as well.
00:27And when I go up to Tours, where a submenu is indicated, the menu flies out to
00:32the side and I can scroll over to there.
00:35And you see the text changing color on hover.
00:38This menu uses an external style sheet, nav.css, for all of its styles.
00:44And the HTML that we see here is actually an unordered list.
00:50So I think that's a pretty nice- looking menu. I hope you agree.
00:53And best of all, it's all done with CSS.
00:56Let's get going.
Collapse this transcript
Understanding vertical menus
00:00As noted throughout this course, if you're going to create CSS-based menus--and
00:04you should be--you'll need to start with unordered lists.
00:08This initial step is pretty straightforward.
00:11So here I have opened the mission.htm file from the Chapter 5 exercise files 05_02 subfolder.
00:19And I want to show you, if I go to Split view, I do have a nav tag--this is an
00:24HTML5 page, by the way--with the id of mainNav.
00:28And my cursor is right there in the middle of it, and that's where our unordered
00:32list is going to go.
00:34Since it's just a plain unordered list, let's drop out of Live view, and I'll
00:39bring up my Style Rendering toolbar and toggle off the CSS Styles.
00:44And now I can go ahead and to start my bulleted list pretty quickly by clicking
00:48in the Unordered List icon in the Property Inspector.
00:52And let's enter that first name, which is Tours.
00:55And if I click over in Design view, you can see that that's been put in as an unordered list.
01:01And even better, now that I am in Design view, I can just hit Return and it'll
01:06create another list item so I don't have to do that code myself,
01:10and type in Mission, Contact, Resources, and Explorers. How easy is that!
01:20So now the next step is to convert all of the list items into links.
01:23We'll do that just by double-clicking to select it, and then going in to the
01:30Property Inspector Link field and adding in tours.htm.
01:37Mission we'll make, of course, mission.htm,
01:41contract.htm, resources.htm, and finally, explorers.htm.
02:02We'll hold off putting in the subnav for now as it makes creating the initial
02:09menu more difficult.
02:11And now we're ready to start adding some CSS into the mix.
Collapse this transcript
Defining width for link elements
00:00With the top-level unordered list HTML finished, you're ready to start in with the CSS.
00:06To keep a clean separation, let's put all the navigation styles in their own
00:10style sheet which you can quickly create in Dreamweaver.
00:13So I'll go up to File > New and from the Page Type column, choose CSS and then click Create.
00:22Now let's save this, and we want to make sure that were in Exercise Files > Chapter
00:295 > Subchapter 05_03 in the _CSS folder, and we'll call this nav.css.
00:42Now once you've created the external CSS file, you can go ahead and close it, and
00:46we'll go to our CSS Styles panel to attach it.
00:51So I'll go down to the Link symbol here and choose Attach Style Sheet, and let's
00:57browse to the correct folder.
01:00Again, Exercise Files > Chapter5 > 05_03_CSS and there is our just-created CSS file.
01:12Click Choose and then OK.
01:15So now that's linked and you can see it here in the Related Files bar.
01:19Now you'll notice that my unordered list is already positioned, and that's
01:24because I have a CSS rule for the ID mainNav already defined.
01:29So let's go ahead and I want to move that over so I can consolidate all of my
01:34navigation rules in one place.
01:37We'll go to Split view and make sure that the main CSS is selected.
01:42Now you could search for this if you needed to, but I happen to know it's on line
01:46150. So there is mainNav and I'm just going to select it, do a Command+X or
01:53Ctrl+X, and then go over and paste it into nav.css. And when I click over into
02:01Live view, it goes back to its original position. Let me close off the CSS
02:06Styles panel for now.
02:08And next, we're going to create a rule targeting the unordered list, so we can
02:12remove the bullets. So we're going to be using our ID of mainNav, starting with
02:18a hash mark, honing in on the unordered list. Then we'll do an opening and
02:26closing curly brace there to contain all of the properties, and let's zero out
02:31the margins and the padding--very common to do these sort of thing. And then
02:37we'll change the a list style to none, which will get rid of the bullets. Okay.
02:44We can go back to Design view now, and you can see that the bullets have been removed.
02:50Now, I'm still getting the hover states that are happening, and this is
02:53because these are links.
02:55It's picking up the same colors and CSS definitions, including that dashed underline.
03:00Well, that's part of my normal site links.
03:03So let's go ahead now and set up a rule for the list item within the
03:08navigation that will determine the overall width of the menu, as well as font characteristics.
03:13I'll head back to Split view and put in our mainNav ul li selector, because we're
03:23targeting the list item.
03:24Now, I'm going to set this position as relative, meaning it will sit where
03:33it's placed within the div. Establish our text alignment with a text align
03:39property set to left.
03:40Now some versions of Internet Explorer-- primarily the earlier ones like 6 and 7--
03:47have a problem identifying with list elements what type of pointer to use, so
03:51we're going to be very explicit here, and I'm going to say cursor use the
03:56pointer. And as I said earlier, we'll set the width and we'll set this to 8ems.
04:03And finally, let's go ahead and set the font.
04:07I'll enter in the size that I want, and if you recall, it's a pretty large font.
04:11I am giving 2em here. And now we'll pick our font family, and we're using
04:16Georgia, Times New Roman, Times, Serif.
04:19So once that selected from the code hint file, I'll hit Return or Enter and then
04:23close out that property with a semicolon. And we already have our closing brace
04:28in place, so let's see how that's looking now by going over to Live view.
04:32Okay, fonts are much larger, and we're still getting the same type of
04:37interactivity, but it's beginning to take shape.
04:39We're now ready to add our background graphics.
Collapse this transcript
Using background graphics with navigation
00:00Background graphics can really make navigation stand out, and with the touch of
00:04CSS finesse, integrate smoothly into the various links states.
00:08I have opened the mission.htm file from the Chapter 5 exercise folder 05_04
00:16subfolder, and as you can see, we have our top-level navigation items in, and
00:22we're ready to add the background ggraphics.
00:25Typically, background graphics are applied to the 'A' or anchor tag in
00:28the navigation item.
00:30This allows the graphic to be modified if necessary during hover states.
00:34We're going to bring the background images into our navbar via the sprite method.
00:39If you wanted to know more about sprite- based background images, check out the
00:42"Implementing sprites" video in Chapter 3.
00:44All right, let's go into Split view. And I already have nav.css opened, and I'm
00:51down at the bottom of the page there, where I'm going to add a new CSS rule, and
00:55this one is # mainNav ul li a, for anchor.
01:03And as you can see, we're just getting more and more specific with each rule.
01:07Now I'll do the opening and closing curly braces, and the first thing we're
01:11going to do is put in a display, block- decoration, and then I will ensure that
01:18the entire area of the anchor tag is an active hit area, including those areas
01:24that we extend with padding.
01:26Next, I'm going to make sure that the Internet Explorer versions can all
01:29properly display the cursor as a pointer.
01:33And now let's add in that padding that I was referring to.
01:36In this case we'll use a .25ems of padding from the top, .75em from the right,
01:45.5em from the bottom, and 1.25em from the left.
01:51Now, this will also have the effect of moving our text up and over so that the
01:57graphic will fit properly.
01:58You can see what I mean if I move over and click into Design view, and
02:03here's what's happening now.
02:04The padding has moved everything over to the right somewhat so that it
02:08lines up with our logo and our call-out down below. And notice as I move my
02:13cursor over to the right, even when I'm not right over the text it still is an
02:18active hit area, and that's because of the extended padding.
02:22Okay, let's go back and add a few more declarations to this rule.
02:26Now, let's go ahead and set up of the default color, which is going to be a
02:30fairly dark gray, put it in as 333, which you can see there, not quite black but
02:38just a little of lightness there. And we want to make sure that the
02:43text-decoration does not appear, so I'll add in text-decoration:
02:49none. And now we're ready for the background image to appear.
02:54So I'm going to type in background:
02:58and we want to make sure that we keep a white background for this, so I'm
03:02going to put in the white-color, which is # FFF. You could also sample that if you want.
03:09And now we're ready for a URL, so I'm just going to click on URL twice there.
03:14And we want to make sure that we're in the Chapter 5 folder in the 05_04
03:19exercises folders and from the _images, go down and choose nav_bg.gif.
03:31Now, there are a couple of other properties that we want to pull into the background.
03:35We want to make sure that it doesn't repeat, so I'm going to do no-repeat, and
03:41then finally positioning is really key with sprites.
03:45And the way that our graphic is set up, I'm going to position it from the
03:48left and top. And now I'll close off that rule. And as you can see the
03:54graphic has now been added.
03:55So far so good, but one of these links is not like the others.
03:59The Tours link is intended to have a submenu.
04:02So let's first switch over to our HTML and add a class to that list item to indicate that.
04:08I'll choose Tours and then go to Source Code, and now at the List Item, I'll
04:14make a space and start typing class.
04:17There is our code hint, and the class we want to put in is called a subNav, okay?
04:22So now we're ready to go back to the CSS. Let's get rid of this extra line and create
04:30a new rule that will make that change for the subnavigation item, so it's going
04:36to be very similar to this selector here.
04:40I'll just go ahead and copy that and paste that in.
04:44The only difference is instead of all list items, we want to go with just the
04:48list item that has a subNav class.
04:53Okay, let's close off the curly brace and put in the background property, also
04:59with the white background, and the URL that we'll choose is from that same
05:07folder in 05_04 images.
05:11And instead of it being nav_bg, it is subnav_bg.
05:19Again, we don't want that to repeat, so we'll put in a no-repeat and left-
05:25top positioning. Okay.
05:29So when I refresh Design view, you can clearly see that right-facing triangle
05:34now that indicates there is something there that every site visitor should
05:38check out. And now we're ready to add in the HTML and CSS that defines and
05:43styles that something.
Collapse this transcript
Creating pop-out vertical navigation
00:00Submenus are a great way to give your visitors quick access to key areas of your site.
00:05In this video, I'll show you the CSS you need to create a submenu that flies out
00:10of a vertical navigation bar. But before we can style the submenu, we'll need to
00:15add in the HTML. With the mission.htm file from the Chapter 5 folder of the
00:21exercise files 05_05 subfolder
00:25now on the screen, let's drop out of Live view and switch over and bring up our
00:30Style Rendering toolbar and toggle off the CSS so that we can very easily add in
00:36our subnavigation HTML. And we do that by just creating a new entry under Tours,
00:43pressing Tab to nest the unordered list, and let's put in three different regions
00:47of California, starting off with Northern California, Central California, and
00:56Southern California.
00:59Now, we do want to create links for these, so I'm going to open up the Properties
01:02panel, select Northern California first, and we'll make that 'nocal', Central
01:11California we'll make 'centcal', and Southern California is of course 'socal'.
01:22So, once those links are all done, we can toggle the CSS back on and turn off
01:28our Style Rendering toolbar.
01:29Now you'll see that the fonts-- especially when we go into Live view--are pretty
01:35enormous for the submenu, and we're going to deal with that in just a moment.
01:41In total, we'll actually need to create four separate CSS rules.
01:45The first one will set up the basic parameters for the submenu and then
01:49by default hide it.
01:52So let's go into Split view nav.css, and we'll create a new rule, still in the
02:00mainNav division, and we're going to target the unordered list that is nested
02:06within the first level unordered list. So we do unordered list, list item, class
02:14subNav ul, and I'll do opening and closing curly braces.
02:20So let's go ahead and set up our margin first,: top, right, bottom and the left I
02:27am going to put in as 100% just so it matches exactly where we are at.
02:31Now, padding I am going to zero out.
02:34We want to make sure that there are no bullets here, so I am going to set
02:37list-style to none.
02:42Again, we'll add in the cursor.
02:43This time I am going to make it default, and we're going to position this menu
02:52absolutely so that it is properly set up. So put in a position absolute, and the
03:01Z-index, because I want this to appear in front of the other content, is going
03:07to be set at 1020. The other content is set at 1000.
03:11Now we'll set the top to zero so that it appears right at the very tippy top.
03:18And as I mentioned, we're going to initially hide it by putting in a display
03:22property set to none.
03:25So now when I click back in, my submenu is gone.
03:28So next we're ready to bring it back in with another rule, and that of course
03:33will be a hover-based rule, mainNav ul li.subNav, and we use the hover state,
03:46again, targeting the unordered list. So we'll set display this time to block, and
03:56I want to also go ahead and set the border to none and make sure when it
04:01appears, it appears just next to my right triangle there,
04:06so I'll set the left position to zero.
04:11Now we are ready to style the text and the background color of the submenu.
04:17So mainNav ul li.subNav ul, and we want to target the list item in that
04:26nested unordered lists.
04:30So let's set the width of the entire menu block to 12ems, and the font size,
04:38we are going to bring way down from the 2ems to 0.5em.
04:44Finally, let's define the background color and make sure that the background
04:49graphic doesn't show up in the submenu.
04:52So for this, we need to target the Anchor Tag, mainNav ul li.subNav ul li anchor).
05:05So our background color is the same tan that we see there, and I am going to go
05:13ahead and choose color here and then choose a placeholder color for the moment--
05:22and you will see why in just a second--and go ahead and set the background
05:29image property to none by typing in url (none) closing the parenthesis and the semicolon.
05:36So now, if I go down and I keep my cursor in the last rule that I selected and I
05:44open up the CSS Styles panel, you can see I have this background color with the
05:48temporary placeholder color that I set in.
05:51So now I can go ahead and click on the color swatch and use the eyedropper to go
05:55over and select the actual tan color that I do want, and you can see the color
06:01value that comes in there.
06:02So let's go take a look at it in Design view.
06:06Now, when I roll over, I get my menu right next to the right triangle, and I
06:12do have Northern California, Central California, and Southern California all as links.
06:17So we're almost home. As you can see, the submenu is flying out with, well, flying colors.
06:24All we need to do now is to define the CSS for the link states.
Collapse this transcript
Setting link states
00:00The vertical menu is almost complete.
00:02The final step is to address the hover state styling.
00:05If we preview the page at this point, you'll notice that on hover I am getting
00:10a dotted orange line underneath the link, and I am getting it pretty much
00:15everywhere--even in the subnavigation.
00:17This is the current default hover state for standard in-body links, and not what
00:23we want for the navigation section.
00:25So let's create a final CSS rule that removes the border and adds a color
00:30highlight to both the text and the background graphics.
00:34With my mission.htm file open from the Chapter 5 Exercise Files folder, I am in
00:41the subfolder of 05_06,
00:45and we're ready to switch over to Split view in the nav.css file.
00:51And I'm going to go all the way down to the bottom and add one more rule.
00:55And this will be a rule that is concentrating on the hover and focus states,
01:01so let's enter our div, #mainNav, and put in the anchor tag and its hover state, a
01:09comma, and then we'll also do the focus state
01:16and one more hover state so that it addresses the subnavigation as well.
01:22And that's going to be #mainNav ul li class subNav a:hover, okay?
01:34Opening curly brace, closing curly brace.
01:37And we want the text to change to the same orange that we see here in the logo.
01:41But again, we can't sample that color from within Code view,
01:45so I am going to go ahead and just put in a placeholder color of orange, and
01:50let's get rid of the border that's on the bottom by putting in a border-bottom
01:55property set to none.
01:57And finally, we need to adjust the sprite that we were using over to its
02:02new hover position.
02:03And so we use the background-position property and set that to a -272 pixels, 0
02:14so it doesn't waver on the top.
02:16Let's close that and then go over to Design view.
02:21And now we can see that the orange is not quite right, but we can open up
02:26our CSS Styles panel.
02:29And I'll go to the All mode, and scroll all the way down to my final
02:35entered rule there.
02:36And instead of orange, I'll go over and sample the correct color from here.
02:41And you can see that that is CC7C29.
02:49But now my menu is complete, including the submenu, and I don't have those
02:53underlines appearing unwontedly anywhere.
02:56So this vertical menu is now ready for prime time, complete with a flyout menu
03:01and integrated background graphics.
Collapse this transcript
6. Internal and External Navigation
Identifying anchor tags
00:00Throughout this course, the majority of the focus has been on navigating from
00:03page to page within a site, but there is another type of navigation that's
00:07frequently employed--internal page navigation.
00:11Typically, you will need internal navigation on lengthy pages that require a
00:14good deal of scrolling.
00:16However, with the rise of cell phone web browsing, scrolling is very much upon us.
00:21The typical solution to handle internal navigation is named anchors.
00:25A named anchor consists of two parts: a triggering link and a target.
00:29Let me show you in a blank page what that code looks like.
00:34So if you go to Dreamweaver > Insert > Named Anchor, and let's call this myAnchor,
00:39Dreamweaver will put in a nifty little anchor symbol that we see here. And if we
00:46go to Code, you can see that it puts in a empty anchor tag with the name
00:51myAnchor, and also an ID of myAnchor.
00:53Now, that's the first part of a named anchor.
00:57The other part would be to create a link in a slightly different place in the
01:01document, let's say Go to My Anchor, which you could then select myAnchor and
01:09put in the Link with a leading hash sign whatever the name of the anchor is, in this case myAnchor.
01:18So if in Live view I clicked on myAnchor, it will go to the top of the document
01:23here wherever the named anchor is.
01:26Now, current web design calls for a rethinking of named anchors for several reasons.
01:32First, the extra markup that you see here is really unnecessary.
01:36You can target links directly to IDs, which conveniently also use a hash mark as an identifier.
01:43Browser support for linking to IDs is pretty much universal.
01:47The last browser that didn't support it was Netscape Navigator 4.
01:51Second, and this is a biggie, support for the name attribute is being dropped in
01:55HTML5, so in this video I am going to show you to code internal navigation in
02:00the right way for now and in the future.
02:02All right, so let's go over to portfolio.htm, and here you can see on this
02:08portfolio page, we have kind of a lengthy page that consists of a number of
02:11projects that we worked on. And on top here there is a listing for each of these,
02:16so you can quickly navigate to them.
02:18I am going to drop out of Live view here and then just go right to the list that you see here.
02:25So the first thing that we'll do is make sure that we have all of the IDs that
02:29we need. And I'm going to go into Split view. And the first one goes right to this
02:35first section here for the technical communication suite, and I am going to give
02:40this an ID in the h2 tag of tcs, and then let's scroll down to the next one, which
02:47happens to be Captivate. And for Captivate, we'll do an id of cp, and then the next
02:55one is for the Dreamweaver C5 Bible, and let's give that an id of bible.
03:02Now to save time, I have done the last three.
03:06Because we've added these IDs, all of the sections now can be
03:09targeted individually.
03:11If we wanted to create a link on the same page, now we are ready to create
03:14those internal links.
03:16Let's scroll back up to where we see Adobe Technical Communication Suite, select
03:21the text here, and in the Property Inspector put in a hash mark. And if you recall,
03:27the heading for that item was tcs.
03:31Now let's do Captivate, which would be hash mark cp. And finally, for the Dreamweaver CS 5
03:38Bible, #bible. And as I said, I went ahead and already did it for the next three.
03:44This one is #dw and so forth.
03:46All right, let's give it a spin.
03:48We'll go to Design view, enter into Live view, and I am going to go ahead and
03:53make sure that I have follow links continuously set up.
03:56Let's close down my Properties, and I should be able to go to any of these
04:00directly just by clicking on the link.
04:02So I'll click on Adobe Technical Communication Suite, and that works.
04:07I'll scroll back up, and let's try the Dreamweaver CS 5 Bible this time.
04:11Yes, that works just as well.
04:14And let's go to the one towards the bottom, the MX 2004.
04:17Now the page will only go as far as it can, and that's why this title doesn't go
04:21all the way up to the bottom, because the page does not extend any further.
04:24Now granted, scrolling back up every time is a bit of a drag,
04:28so the solution most designers opt for is to include another internal link that
04:32takes you back to the top of the page.
04:35Let's follow that route.
04:36Let's go into Split view, and at the end of the Technical Communication Suite, I
04:42am going to put in another paragraph tag and give this is class of top link so
04:48I can style it later. And this will consist of a anchor tag with an href of
04:54#header and I'll close off that tag, put in the content of top and then close the anchor tag.
05:03Now instead of inserting a named anchor, we'll take advantage of an existing
05:06header div and link to that--with the leading hash mark of course.
05:10So let's see how that looks.
05:12That's fine. That's showing up there.
05:14I am going to go ahead and copy that, and let's place it after each of
05:18these elements here.
05:20So after the end of the Captivate one, I will paste that in. At the end of the Bible quote,
05:27I'll paste that in, and let's go ahead and do it for the remaining three here,
05:31two, and then the final one is here.
05:38So now I should have little top links there.
05:42Notice they are kind of inconsistently placed along.
05:44So let's add in a little CSS rule in order to move them over to the right, and
05:50we'll also kind of shrink them down a little bit.
05:52So I'll open up my CSS Styles panel and create a new rule.
05:58You can see that the selectors are quite large here.
06:00I am going to go ahead and reduce that somewhat.
06:02I need a number of these items in order to maintain the specificity, but I don't
06:07need quite that many.
06:08So here we have outerWrapper content, and we're going to go ahead and throw in a p tag here.
06:14So this will address the toppling classes that are found within paragraphs that
06:20are within the content class and also within the otherWrapper. Click OK and
06:25let's change the font size to 12, which is a little bit smaller than my text,
06:30switch to the Block category and let's align that over on the right.
06:34Okay, let's see how that works.
06:36Now, I have a top link consistently over on the right.
06:39That looks pretty good.
06:40Let's give it a try.
06:42Let's go to the CS5 Bible and then click top, and it comes back up to the header
06:46div, which is the top of my page. So the one downside I've found of using this
06:51technique rather than inserting a Dreamweaver named anchor is that it doesn't
06:55allow Dreamweaver to display that wonderful little ship anchor for the name
06:59anchor in visible elements in Design view.
07:01On the other hand, it's far better coding all around.
Collapse this transcript
Identifying external links
00:00For some web sites, especially those for government and large corporations,
00:04it's important to differentiate between links to pages within the site and
00:08links to external sites.
00:10In this video, I'll show you how to set up a single CSS rule that can add an
00:14identifying icon to all your external links in one fell swoop.
00:19The icon we'll be using is one that has gained a good deal of acceptance on the
00:22web, from Wikipedia to the Federal Health and Human Services web site.
00:27You can find it here on WIKIMEDIA COMMONS, and it's this icon here that we see
00:32in a larger version.
00:33And we're going to be using one of the smaller varieties.
00:36So let's go back to Dreamweaver.
00:38And here I have two links that actually go to external sites: this Take the
00:43tour and a little bit further down, Check 'em out.
00:48So I want to add a CSS rule that looks at the value of the href attribute, and if
00:54it starts with an http, then apply this rule.
00:58So let's go ahead and go to Split view.
01:00And I am going to go ahead and put this in the main.css.
01:03I'll put this down at the bottom.
01:05And the CSS rule that we're going to adopt is starting off with the anchor tag,
01:09and then you use square brackets whenever you're trying to reference an
01:13attribute within a tag.
01:15So I'll do an opening and closing, just to make sure we have that.
01:18And we have to look for the href attribute.
01:21And now we need to put in a caret, which is Shift+6, and then an equal sign.
01:27The ^= sign is an advanced selector used in CSS3 that says just look at the
01:34beginning of the value for the attribute.
01:37And what we're looking for is http, and then I'll close that.
01:41Notice that I didn't do http://, even though that would be valid for a number of sites.
01:48I initially stopped at the p in order to also encompass https sites, which are secure HTTP.
01:57All right, we have our selector, so I'll do my opening and closing curly braces.
02:02And now we're going to put in a background tag.
02:05So this is background:
02:07and then double-click on URL to open up the Select File dialog box.
02:12And we want to choose this from the Chapter 6 > 06_02 > images folder.
02:18And you're looking for a file named external_link.png.
02:23I'll click Choose here and then enter in no-repeat.
02:28And we want to center this on the right of the link.
02:32Close off that declaration with a semicolon.
02:35And then let's add just a little bit of padding on the right in order to allow
02:39room for the icon itself.
02:41And the icon is about 12 pixels wide, so we'll just do 13 here to give us a
02:46little bit more room.
02:47So now, when I go to Design view, you can see that I have my icon appearing
02:53right where it says Take the tour.
02:55And if I go down to Check 'em out, there is the other icon automatically added
03:00to any external link. Sweet!
03:03So hopefully this tip will come in handy when you land that lucrative government
03:07web design contract.
Collapse this transcript
7. Cutting-Edge Navigation
Creating jQuery animated image menus
00:00JavaScript frameworks have created a revolution in web design by bringing
00:05complex functionality within reach of everyday web designers.
00:09In this video, I'll show you how to combine CSS and one of the most popular
00:13frameworks, jQuery, to create a dynamic, animated menu.
00:17Let me show you the final product that we're aiming for.
00:20Here you see five navigation categories up top.
00:23When I move over it, four of the navigation categories move over, and the same
00:28thing happens as I scroll over each of the animated menus.
00:31They roll into view, and the other ones are slightly hidden but still accessible.
00:36So if I want to choose one from the middle and then roll off, everything is
00:39animated from left to right,
00:41complete with some very nice kind of easing that you'll see here with the animations.
00:46This is hours of fun to play with. Let me tell you.
00:48So let's go ahead and start with the index.htm file. And as you can see, we have
00:54to start with--surprise, surprise--an unordered lists for the navigation.
00:58Now each of these items as I go to Split view, you can see has its own id,
01:04homenav, eventsnav, companynav, and so on.
01:08So I've taken the liberty of going ahead and creating a blank CSS file for us
01:13and already linked it, and let's start by building out the CSS.
01:17First, we are going to go ahead and tackle the nav div itself, and for that we'll
01:24start by putting in the width of 630 pixels and we want to make sure that we
01:29keep everything within the width,
01:30so I am going to add an overflow property here and then hide that and zero out the margins.
01:38I'll just close off the rule here.
01:40Now, let's move on to the UL, or unordered list, tag within the nav div, and as
01:46we've done previously in the course, we're going to get rid of the bullets by
01:51going to list-style and setting that property to none.
01:56Now we need to make a margin adjustment for the unordered list, and I am
02:01going to set that 0 0 0, which sets everything to zero except for the left, which
02:07I'll set at -40 pixels.
02:10Finally, I'm going to set the width to the UL element to a whopping 1,600 pixels wide.
02:18This is the width of all of the pictures which are each 320 pixels times five,
02:22which is necessary to contain it.
02:24Now because we have overflow hidden up here, you won't see those elements.
02:29So let me close out the nav ul rule. And the next thing to do is address the
02:34list item, and all we are going to have to do with that one is just float it to the left--
02:38again, because we want our list items to appear in a horizontal fashion.
02:42So, we'll do nav ul li, and I'll set the float property to the left and close that rule.
02:51Next, we'll work with the anchor tag, and as usual, it's doing much of the heavy lifting.
02:55In addition to hiding the text links, this rule will also set the width for the closed panels.
03:01So I'll go ahead and write out the selector, nav ul li a, and do my open and
03:08closing curly brace here.
03:10I mentioned that I was going to hide the text links, and I'll do that by using a
03:14text-indent property set to a -2,000 pixels.
03:19Now, let's go ahead and set up the background, and I am going to set that to white
03:25with no image, and I can finish off this declaration with a semicolon.
03:31Next, I want to add a border separating each of the images,
03:35so I am going to choose a border right and set that two pixels wide, make it
03:42solid, and we'll use a white color there.
03:46Next, I am going to add in a cursor specifier for Internet Explorer so that it
03:51doesn't have to worry about what kind of cursor to use.
03:55Again, with the anchor tag, as we often do, we'll put in a display block to
03:59increase the size of the hit area. Now we'll set the width, and this will be
04:04the width of each of the images when they are closed.
04:07So that's going to be 78 pixels, and the height is consistent throughout,
04:12and that's 200 pixels.
04:14So now if I switch over to Design view, drop out of Live view here, you can see
04:20the shape beginning to take form, and now it's time to bring in the images.
04:25So go back to nav.css and create the first one, which is going to be nav ul li,
04:33and we are going to target the first list item, which is home. And if you recall,
04:37that ID was homenav, and we're looking exactly at the anchor tag that's in that
04:42list item, and we want to bring in the background URL. And you want to make sure
04:51that you're in the exercise files Chapter 07 folder, in the 07_01, and drill
04:59down to the images folder, and here you'll see a series of images, each starting
05:03with the initials dw.
05:05We are looking for dw_home.jpg, click on Choose, and we want this to repeat with
05:14a special value of scroll set to 0%.
05:19So now this rule is essentially the same one that we are going to use for all of the pictures.
05:24So I am going to go ahead and copy that, paste it, and let's go ahead and update
05:28the selector first, which is events. And the name of the picture is also
05:34dw_events, and then we'll paste in another copy and change the selector to
05:40company and the picture name to dw_company.
05:46The fourth one is gallery, and the final one is booking.
05:59Now, we do need to add one more property to this final one in order for that to
06:04be the image that is remaining open, and we want to give that a minimum width
06:08property of 320 pixels.
06:12So now let's take a look at how it's working in Live view.
06:16It looks like we've got everything in place, and of course there is a little magic
06:21already buried in the page, and that's the JavaScript. And I just want to take
06:26you through a quick tour of the JavaScript, just so you see a little bit of what's going on.
06:30So let's Code view, and you can see there are a series of script links here that
06:35are bringing in extra code libraries.
06:37The primary one is the jQuery code library that we're hot-linking to, and this is
06:43from jquery.com. jQuery 1.5 is the latest version as of the recording of this
06:49course, and then there are a couple of other easing libraries.
06:52Easing is an animation term that makes movement seem more natural.
06:57Here is the open script tag, and this is a very common thing that you'll see in
07:02jQuery where it is the functionality that says 'wait till the document is ready
07:08and fully loaded and then begin doing your functions'.
07:11As you can see, there are a series of functions that are geared to the hover
07:15state, and once something is being animated, classes are added and animations
07:21are begun and the time for the animation is set and the type of easing is established.
07:27Diving too deep into jQuery is beyond the scope of this course, but if you find
07:31the time to do it, you will be richly rewarded.
07:34As you can tell, while it takes a bit of work and stretching your skill set a
07:37tad, you can really create some killer navigation by combining CSS with a
07:42JavaScript framework like jQuery.
Collapse this transcript
Using the HTML5 nav tag
00:00HTML5 is coming fast down the pike and bringing with it a boatload of changes,
00:05including a tag specifically intended for navigation.
00:08The nav tag is one of a group of what are known as semantic tags.
00:13Semantic tags are intended to more clearly convey what the markup holds.
00:17And in the case of the nav tag, that's primary as well as a secondary and other navigation.
00:23Let's take a look at an example.
00:24We've used this page in several movies in the course, including Chapter 5 on
00:28vertical navigation.
00:29So let me go over to Source Code,
00:32and here you see right near the top, a nav tag with an id of mainNav.
00:37Now notice this is not a div tag with an id of mainNav;
00:41it's actually a nav tag.
00:42And if I happen to remove it temporarily, and then type it back in, you'll
00:48notice that after I type a couple of the letters just 'na', Dreamweaver's
00:52code hints come up.
00:53So we have code hint support in Dreamweaver CS5.
00:56And I can add in the id = mainNav, and that's really all there is to it.
01:02There are no additional syntax to learn for the nav tag.
01:06But if you decide to work with HTML5 tags like nav now, there are a few
01:10things you should know.
01:12First, you need to declare a proper DOCTYPEm such as !DOCTYPE HTML.
01:17This is the DOCTYPE that's being recommended currently by the WC3 for HTML5, and
01:22web designers all around the world are applauding its simplicity.
01:26Now that you made sure that your pages are forward compatible, you need to make
01:29sure that they are also compatible with older browsers.
01:33Most browsers will basically ignore the strangeness of any tags they don't know
01:37and render them according to whatever CSS rules are applied.
01:41However, because they don't assign any basic properties, there's one that you
01:45have to do yourself, the display property.
01:48If you don't include a CSS rule that specifies a display property and value for
01:52the nav and other HTML5 semantic tags, most of the current crop of browsers--and
01:58all of the old ones--will just assume it's an inline tag, which would be
02:02disastrous for your pretty distinct nav bar.
02:05Therefore, you have to create a rule like this one, in the main.css file, found on line 67.
02:13Notice what we have here are most of the semantic tags that are used in HTML5,
02:18including the nav tag.
02:20And they're all set to one property, display:block.
02:24Now I was careful to say that most browsers will ignore unknown tags.
02:29That's not the case with Internet Explorer browsers before version 9.
02:33They will all totally block if they encounter an unknown tag.
02:36To get around this problem, you need to include a conditional comment that
02:40targets all IE browsers before 9.
02:43Like the one that we have in the source code here, right before the end of
02:46the head tag, this conditional comment looks for versions less than IE9, and
02:53if the browser being used by the site visitor is one of those, a certain
02:56script is included.
02:57And this is the html5shiv that is being stored in the Google Code Repository.
03:03This JavaScript file, html5.js, is just enough code to make sure that those older
03:10Internet Explorer browsers will handle the new tags without choking.
03:14That's all there is to working with navigation in HTML5.
03:17It'll be really interesting to see how browsers and other web technologies
03:21evolve to put the new nav tag to use.
Collapse this transcript
Exploring CSS3 enhancements
00:00While the ability to incorporate background images in navigation gives web
00:04designers a great deal of flexibility, it's also a tad annoying.
00:08Any changes mean breaking out your graphics program, finding the source file, and
00:12crafting the updates, and then exporting the images and testing.
00:16Wouldn't it be great if you could just create tab navigation with rounded corners
00:20and complex gradients all in Dreamweaver?
00:23Well, with CSS3 you can.
00:25In this video, I am going to create the tab navigation we built using the
00:29Sliding Door technique in the Chapter 03 video "Setting up adjustable
00:33backgrounds" that you can see here.
00:36We'll start with the css3nav.htm file.
00:40Now, I have all the basics in place, so we can just concentrate on the CSS3 enhancements.
00:45Notice that I have hovers happening, and my background colors changing. Pretty simple.
00:50So let's go to Split view and I am going to go up to the anchor tag here, which
00:56is nav li anchor (a) and I am going to add a couple of rules.
01:00Now the nice things about this with Dreamweaver is it has full code hint support.
01:04So if I type in -webkit, you can see that that first comes up, and if I hit
01:09webkit, I get a full list of all the webkit browser-specific properties.
01:15So the one we are looking for is border and we actually want the top-right
01:21so let me scroll down to here, border- top-right-radius, and we want to set
01:26that to eight pixels.
01:27This is going to give our top-right corner a rounded radius of eight pixels, and
01:33we want to do the same thing for the top-left,
01:35so I am going to do -webkit and then hit return and just start typing border
01:40and locating the top-left radius and also making that eight pixels.
01:45Now, not only does it support the Safari webkit rendering engine, but Dreamweaver
01:49also has support for Mozilla, which creates of course the Firefox browsers.
01:54So it's -moz and the syntax here is border-radius topright and topleft.
02:04We of course want these to match, so I am going to go ahead and make those eight
02:07pixels and then do the one for the other border radius, which is topright, also
02:15making that eight pixels.
02:17Now I mention that this is a CSS3 property, so it is in the spec. And if all
02:23browsers get around to supporting it, we want to make sure that we already have
02:27that built in so we're not just targeting Safari and Firefox browsers.
02:33So we'll put in the generic, if you will, CSS3 properties, which is
02:37border-top-right-radius, and there is the code hint support for that. And of
02:43course we are going to make that eight pixels, and we also want to do the same
02:48thing for the topleft.
02:51Okay, so if we go over to Live view here--I am going to just shrink down so
02:56you can see everything--notice we have very nicely rounded corners there,
03:00without any images. And now we are also ready to address the gradients without
03:06using an actual background image--although we do need to employ the background image property.
03:10So I am going to go to Full Code view because the syntax for the background
03:14image gradient is kind of lengthy. But this also goes to the anchor tag and
03:19after all of our properties that we used to create the rounded corners, we'll
03:22put in a background image property to start. And then for a value, we'll start by
03:27putting in a webkit-specific value, and unfortunately there is no code hint
03:32support here, so you'll have to put in webkit-gradiant, and this is followed by
03:38a set of parentheses.
03:40Within the parentheses, we say what type of gradient it is, and this is going to
03:44be a linear gradient. And where does it start?
03:48It starts at the left top, comma, and it goes to the left bottom, comma.
03:56Now, what's the color range?
03:57Well, it goes from, the keyword, and then in parentheses, whatever you're
04:02starting with, and in this case we're starting with the white. Close the
04:06parentheses comma, to, and then whatever the final element is, and in this case it
04:12is a hexadecimal value of e4e4e4.
04:16I need one more parentheses to complete this and then a semicolon.
04:21Now, that will handle the gradients for webkit.
04:24There is a different syntax for Mozilla, but it also uses the background image property.
04:32So we start with a -moz and the type is actually put in the name of the property here,
04:39so it is linear-gradient and we have a parentheses set.
04:45Now instead of doing directions left top, left bottom, Mozilla actually works by degrees.
04:51So in order to get a linear gradient you put in -90 degrees, or deg, followed by the
04:58two colors the top color, which is going to be #fff, and the bottom color, which
05:03again will be #e4e4e4.
05:07So now let's close that out with a semicolon, and let's head back to Design view
05:12and see how we are doing.
05:13Well, you can see the gradient is already in place, and when I hover over it, I go
05:18back to the solid color, so I am going to have to add another rule to handle that
05:22gradient, but it looks pretty good.
05:24We are going right from white to this light tan and pretty effective I think.
05:29So let's go back to code and will add in one more rule to make sure that we take
05:35care of the hover state.
05:37So you'll notice right below our pretty lengthy nav li a selector is the nav li
05:44a hover selector, and that's exactly where will need to put in the code for the
05:49gradients, so we can get a reverse gradient here. And I am going to go ahead and
05:53just copy this, because it's the same syntax it's just different values, and paste that in.
05:59Now, I am just going to reverse the two colors.
06:02So instead of fff here, I'll make this e4e4e4 and we'll switch this to fff, and
06:10then we'll do the same thing for Mozilla.
06:13In this case, I'll just cut that and then paste it in.
06:16All right, so let's take a look at it in Live view, and now you can see that the
06:20background gradient switches on hover as well.
06:23Now, the cool thing is that these navigation buttons are just as flexible as
06:27those built with the Sliding Door technique.
06:29So if I go to Split view, and let's click on products here and make that Products
06:34and Services, and again we'll change services to the Contact Page and just go
06:43strictly to Design view,
06:44you can see that the button stretches the way that we would hope it had.
06:47Now granted this CSS3 functionality is restricted to just the latest Firefox and
06:52Safari browsers, but if you need to, you can replicate it with an Internet
06:56Explorer gradient filter.
06:58I think this peek into some of the CSS3 features is quite instructive in terms
07:02of what's coming in the near future.
07:04I hope you agree.
Collapse this transcript
8. Conclusion
Next steps
00:00Thanks for taking the time to check out Dreamweaver CS5 Building Site
00:04Navigation with CSS.
00:06I hope you enjoyed watching the course as much as I did making it.
00:09If you're interested in learning more about designing web site navigation, take
00:13a look at Fireworks CS5 Rapid Prototyping, or Photoshop CS5 for the Web, two
00:19other lynda courses that I can recommend-- both of which have great tutorials on
00:24creating web site navigation elements.
00:26Thanks again for watching.
Collapse this transcript


Suggested courses to watch next:

Managing CSS in Dreamweaver (4h 40m)
James Williamson

Layouts with CSS in Dreamweaver (3h 33m)
Joseph Lowery


Typography with CSS in Dreamweaver (2h 30m)
Joseph Lowery

CSS for Designers (7h 40m)
Molly E. Holzschlag


Are you sure you want to delete this bookmark?

cancel

Bookmark this Tutorial

Name

Description

{0} characters left

Tags

Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading
cancel

bookmark this course

{0} characters left Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading

Error:

go to playlists »

Create new playlist

name:
description:
save cancel

You must be a lynda.com member to watch this video.

Every course in the lynda.com library contains free videos that let you assess the quality of our tutorials before you subscribe—just click on the blue links to watch them. Become a member to access all 100,984 instructional videos.

start free trial learn more

If you are already an active lynda.com member, please log in to access the lynda.com library.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Access to lynda.com videos

Your organization has a limited access membership to the lynda.com library that allows access to only a specific, limited selection of courses.

You don't have access to this video.

You're logged in as an account administrator, but your membership is not active.

Contact a Training Solutions Advisor at 1 (888) 335-9632.

How to access this video.

If this course is one of your five classes, then your class currently isn't in session.

If you want to watch this video and it is not part of your class, upgrade your membership for unlimited access to the full library of 1,943 courses anytime, anywhere.

learn more upgrade

You can always watch the free content included in every course.

Questions? Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com.

You don't have access to this video.

You're logged in as an account administrator, but your membership is no longer active. You can still access reports and account information.

To reactivate your account, contact a Training Solutions Advisor at 1 1 (888) 335-9632.

Need help accessing this video?

You can't access this video from your master administrator account.

Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com for help accessing this video.


site feedback

Thanks for signing up.

We’ll send you a confirmation email shortly.


By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

By signing up, you’ll receive about four emails per month, including

We’ll only use your email address to send you these mailings.

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked