Showcase and discover digital art at yex

Follow Design Stacks

Subscribe to our free newsletter to get all our latest tutorials and articles delivered directly to your inbox!

Designing with CSS in Dreamweaver MX 2004 – Part 3: Creating the Banner Selector

Creating the Banner Selector

The next stage of the process is to create the banner div. Because the content within the wrapper flows from top to bottom, you first create the banner div, then the content div, and finally the footer div. The page will just flow naturally; there will be no defined positioning within this page. So you need to place the elements within the wrapper in the order that they will appear in the document. The first element within the wrapper is the banner, which you created in the previous section. Now create the selector for the banner.

The banner div is an ID type selector and it will be the first div you place within the wrapper div. Because we are simply letting the divs flow down the page, the banner div must take its place right after the opening wrapper div tag. The only property and value pair you need to add to the banner selector is the height property and its value. There is no content within the banner div that will be cut off in case the user resizes the browser text, so the height property in this instance is safe to use. Make the banner div 110 pixels high.

The banner selector should look like the following:

height: 110px;

Now that you have created the banner selector, I will show you how to set up a background image for this particular div. This time let’s use Dreamweaver’s code hints so that you can see just how easy Dreamweaver makes it for you to set up a background image right from within the CSS file.

  1. Locate the banner selector in basiclayout.css.
  2. Place your cursor after the height value and press Enter to create a new line. The code hints list appears.
  3. Select background-image from the list to insert the background-image property.
  4. Click Browse in the pop-up menu. This opens the Select File dialog box.
  5. Navigate to your background image and double-click it to insert the path as the value.
  6. Add a semicolon after the path to complete the process.
  7. Press Enter to to create a new line. The code hints list appears.
  8. Select background-repeat from the list, followed by no-repeat.
  9. Add a semicolon at the end of the line.
  10. Save your CSS file.

Your banner selector should now look like the following:

height: 110px;
background-image: url(../images/banner_bg.jpg);
background-repeat: no-repeat;

Now add the banner div to the XHTML document, switch to the Code view, and use the same technique that I demonstrated when inserting the wrapper div:

<div id="wrapper">
<div id="banner"></div>

This code shows the banner div in position within the page. Notice how it is positioned immediately after the opening wrapper div tag and that the banner is completely encased within the wrapper div. Preview the page in the browser of your choice (see Figure 12).

The banner positioned on the page

Figure 12. The banner positioned on the page

Next we look at inserting navigation into the design.