A rollover image is an image that appears to change when a visitor to your site points to the image with the pointer. For example, a button on a page might appear to light up when the visitor points to it. Dreamweaver provides the ability to easily create a navigation bar consisting of a set of rollover images.
A rollover image consists of two images: the image displayed when the page first loads in the browser, and the image displayed when the visitor moves the pointer over the original image.
A navigation bar allows you to provide up to four images for each button: the normal two for a rollover, plus images that indicate that a navigation button is already active on a given page. In this lesson, however, you'll create a navigation bar that uses only the standard two rollover images for each button.
Note: When creating a rollover or navigation bar, make sure that all the images for each button have the same width and height (in pixels).
In some browsers, navigation bar buttons that aren't in a table may wrap onto a new line if the visitor makes the browser window too narrow. To avoid such wrapping, add a CSS style to the div tag surrounding the navigation bar.
To create a navigation bar:
Switch to the main (index.html) page if it's not the current page. (If the page isn't open, open it by double-clicking its icon in the Files panel.)
In the Document window, place the insertion point where you want the navigation bar to appear. On the Trio Motors main page, for example, you'll be placing the navigation bar immediately after the banner image at the top of the page; so select that image, then select the <div.logo> tag in the tag selector at the bottom of the Document window. Now press Right Arrow to ensure that the insertion point is outside of the div tag that contains the banner image.
Select Insert > Layout Objects > Div Tag. In the Insert Div Tag dialog box, type navbar in the Class text box, and click OK. Then press Backspace (Windows) or Delete (Macintosh) to delete the placeholder text that appears.
Select Insert > Image Objects > Navigation Bar.
The Insert Navigation Bar dialog box appears.
In the Element Name text box, type a name for the button, such as showroom_button.
This gives the button a unique name and makes it easily identifiable in the HTML code.
Click the Browse button next to the Up Image text box, then navigate to the btnShowroom.jpg file in your site's images folder (inside the assets folder). Make sure the Relative To pop-up menu is set to Document, then click OK or Select (Windows) or Choose (Macintosh).
The Up Image text box displays the path to the image: Assets/images/btnShowroom.jpg.
Note: If it shows a longer path, you probably chose an image file in a different folder, or else you chose something other than Document from the Relative To pop-up menu. Click the Browse button and try again.
The Up Image text box indicates the image to display when the button is in the "up" state, which is usually when the page first appears in the browser.
Click the Browse button next to the Over Image text box, then navigate to btnShowroom_on.jpg in your site's images folder. Make sure the Relative To pop-up menu is set to Document, then click OK or Select (Windows) or Choose (Macintosh).
The Over Image text box indicates which image to display when the pointer is pointing to the image in the browser.
Leave the Down Image and Over While Down Image text boxes blank.
In the Alternate Text text box, type Showroom.
In the When Clicked, Go To URL text box, type showroom.html.
This step causes the rollover image to link to a page called showroom.html. That page doesn't exist yet; if you were creating a complete Trio Motors site, you would have to create that page.
Make sure the Preload Images option is selected so the rollover images load when the page opens in the browser, ensuring a quick transition between images when a visitor moves the pointer over the original image.
Deselect the Show "Down Image" Initially option.
Click the Plus (+) button at the top of the page to add another button to the navigation bar. Repeat steps 6 through 13, entering news_button forthe element name, btnNews.jpg forUp image, btnNews_on.jpg for Over image, News foralternate text, and news.html forURL.
Click the Plus (+) button at the top of the page again to add another button to the navigation bar. Repeat steps 6 through 13, entering owners_button forthe element name, btnOwners.jpg for Up image, btnOwners_on.jpg for Over image, Owners foralternate text, and owners.html forURL.
Click the Plus (+) button at the top of the page again to add another button to the navigation bar. Repeat steps 6 through 13, entering services_button for the element name, btnServices.jpg for Up image, btnServices_on.jpg for Over image, Services foralternate text, and services.html forURL.
In the Insert pop-up menu at the bottom of the dialog box, make sure that Horizontally is selected.
Deselect the Use Tables option.
Click OK to close the dialog box and create the navigation bar.
The images specified in Up images appear in the document.
Save your page.
To make sure the navigation bar buttons stay together on one line:
Select one of the navigation bar images in the Document window.
In the tag selector, select the <div.navbar> tag.
In the CSS Styles panel (Window > CSS Styles), click the New CSS Style button.
In the Selector Type options, select Class, and type .navbar in the Name text box. Be sure to include the period at the beginning.
For Define In, select This Document Only.
Click OK.
In the CSS Style Definition dialog box, select the Block category.
In the Whitespace pop-up menu, select nowrap.
Click OK to define the style and dismiss the dialog box.
Note: Rollover images and navigation bars don't change when you roll over them with the pointer in the Document window in Dreamweaver; the images change only in a browser. To make sure your navigation bar works, you need to preview your page in a browser. For information on previewing, see Preview pages in a browser.
Comments
Kathleena
said on
Nov 29, 2004
at
7:20 PM :
I want to know how to make an image button that holds text and then to link it
No screen name
said on
Sep 6, 2005
at
8:13 AM :
right, i've followed the steps to keep the navigation buttons together in one line; but they still won't? Why? (Getting Started, 2wards end on chapter 5!)
when i first insertd em, they weren't in a straight l;ine, i put em in a staright one line & created new CSS called .navbar, just followed through. when i copy & paste navbar to another html file then they split gain onto two lines, when i open it into inter exploere or firefox then they split into two lines again!!! Somebody help me!
No screen name
said on
Mar 23, 2006
at
8:55 PM :
To 9.06.05 Entrant... to keep the nav bar images in a row are you using your browser to view the status of your navbar? In my design view I experience wrapping but when I load it in Firefox the bar does stay the nowrap mode. The column on the right goes over the top of the navbar. (at least from my view) I hope this helps.
Comments
Kathleena said on Nov 29, 2004 at 7:20 PM : No screen name said on Sep 6, 2005 at 8:13 AM : No screen name said on Mar 23, 2006 at 8:55 PM :