Adobe
Products
Acrobat
Creative Cloud
Creative Suite
Digital Marketing Suite
Digital Publishing Suite
Elements
Photoshop
Touch Apps
Student and Teacher Editions
More products
Solutions
Creative tools for business
Digital marketing
Digital media
Education
Financial services
Government
Web Experience Management
More solutions
Learning Help Downloads Company
Buy
Home use for personal and home office
Education for students, educators, and staff
Business for small and medium businesses
Licensing programs for businesses, schools, and government
Special offers
Search
 
Info Sign in
Welcome,
My cart
My orders My Adobe
My Adobe
My orders
My information
My preferences
My products and services
Sign out
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out My orders My Adobe
Preorder Estimated Availability Date. Your credit card will not be charged until the product is shipped. Estimated availability date is subject to change. Preorder Estimated Availability Date. Your credit card will not be charged until the product is ready to download. Estimated availability date is subject to change.
Qty:
Purchase requires verification of academic eligibility
Subtotal
Review and Checkout
Adobe Developer Connection / Dreamweaver Developer Center /

Taking a Fireworks comp to a CSS-based layout in Dreamweaver – Part 3: Layout and CSS

by Sheri German

Sheri German
  • Community MX

Content

  • Creating the external style sheet
  • Writing the body rule
  • Writing the container rule
  • Creating rules for Module 1, the header div
  • Creating rules for Module 2, the masthead div
  • Creating rules for Module 3, the page content
  • Creating rules for Module 4, the footer
  • Ordering the style sheet
  • Using the Spry Accordion styles
  • Using the Tabbed Panel widget
  • Checking browser compatibility

Created

2 June 2008

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
CSS design Dreamweaver CS3 Dreamweaver CS4 Fireworks CS3 Fireworks CS4 prototyping website workflow

Requirements

Prerequisite knowledge

Part 1 and Part 2 of this tutorial series.

User level

Beginning

Required products

  • Fireworks (Download trial)
  • Dreamweaver (Download trial)

Sample files

  • blimey_files.zip (95 KB)

Note: This tutorial was written for Dreamweaver CS3. Although Dreamweaver CS4 adds new CSS functionality (revised Property inspector, Code inspector, related files), the CSS panel in Dreamweaver CS4 has not changed, and you should still be able to follow this tutorial using Dreamweaver CS4.

This three-part tutorial shows how to use Fireworks and Dreamweaver to design and build a fictitious blog named Blimey. Part 1 showed you how to prepare images in a Fireworks comp for the structural markup of the layout. In Part 2, you coded the markup that provides the hooks for the cascading style sheet.

This part of the tutorial shows you how to complete the layout and create the style sheet.

Creating the external style sheet

There are several ways to create an external style sheet in Dreamweaver. In this tutorial, you will use the Plus (+) button on the CSS Styles panel:

  1. If the CSS Styles panel is not open, choose Window > CSS Styles to display it.
  2. Click the Plus (+) button to open the New CSS Rule dialog box (see Figure 1).
  3. Select Advanced as the selector type, so you can use group selectors.
  4. Type the group selector body, h1, h2, h3, h4, p, ul, li in the Selector field. (Separate each selector by a comma and a space.)
  5. Make sure the Define In option is set to New Style Sheet File. One of the two Spry style sheets is selected by default, so you'll need to use the popup menu to access New Style Sheet File.
The New CSS Rule dialog box
Figure 1. The New CSS Rule dialog box
  1. Click OK.
  2. A navigation dialog box opens. Browse for the Blimey site you developed in Part 2 of this tutorial, or use the starter files in the support_files folder for this tutorial.
  3. Name the new style sheet blimey.css.
  4. Click OK. The CSS Rule Definition dialog box opens (see Figure 2).
  5. Select Box from the Category list.
  6. Leave the Same For All option selected for both Padding and Margin, and type 0 for both.
  7. Click OK.
CSS Rule Definition dialog box
Figure 2. CSS Rule Definition dialog box

This procedure writes the first rule to an external style sheet and attaches it to the current page.

This rule may strike you as odd. If you are new to CSS layouts, you may not know that before you apply a single rule to your page, there is already a browser style sheet that affects its display. Many elements have default values; such as those you added to the group selector. These values vary from browser to browser and thus lead to differences in the layout when you add your own values. By zeroing out these elements, you give your layout a consistent starting place for the values in your own style sheet. Many developers reset many more elements, and sometimes include other properties such as borders set to none. To learn more about browser style sheets and how to reset them, you can read the following articles by Eric Meyer:

  • Reset Styles
  • Rethinking CSS Reset

Note: If you need to edit a rule after you have closed its dialog box, simply select it and click the Edit Style button (the pencil icon) at the bottom of the CSS Styles panel. You can also edit properties and values directly in the Properties section of the CSS Styles panel.

Writing the body rule

The next rule you will write is for the body element:

  1. Click the Plus (+) button to open the New CSS Rule dialog box (see Figure 3).
  2. Select Tag as the selector type.
  3. Type body in the Tag field.
  4. Make sure the Define In option is set to blimey.css. (From now on, assume that all rules are defined in this external style sheet.)
  5. Click OK.
Settings for the body rule
Figure 3. Settings for the body rule
  1. Select Type from the Category list in the CSS Rule Definition dialog box (see Figure 4).
  2. In the Font pop-up menu, select a sans-serif list such as one that begins with Arial or Verdana.
  3. In the Color field, click the color picker and set the color to #333333 (dark gray).
  4. In the size field, type 100 and choose % as the unit of measurement.
  5. Click OK.
CSS rule definition for the body type
Figure 4. CSS rule definition for the body type

Note: The settings in Figure 4 instruct the browser to display the text at 100% of whatever the user has set in the browser preferences. For example, someone with impaired vision may have changed the browser preferences from the default font size of 16 pixels to 18 pixels or higher. In later exercises, you will scale other text such as h1 and p from that user setting. By setting the body to 100% of the user's browser font size, all future font sizes will scale from that starting point. For example, if you later set the paragraph font size to 85%, it will be 85% of the user's font preference, whether that is 12, 14, 16, 18, or more pixels.

Writing the container rule

Before you style any of the div elements, or divs, in the various modules, you will style the container div that will be common to all of them. Because you will reuse the container four times, use the class selector type.

The width of the container is constrained to 770 pixels, and it is placed inside a div such as header whose background color band spans the entire width of the browser window.

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Class as the selector type.
  3. Name the selector .container and click OK.
  4. Select Box from the Category list in the CSS Rule Definition dialog box.
  5. Type 770 in the Width field and choose pixels as the unit of measurement.
  6. Deselect the Same For All option under Margin.
  7. Type 0 for top and bottom margin.
  8. Select auto from the pop-up menus for the right and left margins and click OK.
CSS rule definition for the container class
Figure 5. CSS rule definition for the container class

The auto margins center the layout in modern browsers. Internet Explorer 5 does not understand this value. If you need to support that browser, you can learn how to center layouts for it in Do You Want To Do That With CSS? — Centering a Wrapper by John Gallant and Holly Bergevin. Alternatively, you may decide that there are not enough visitors who still use this very old browser to bother with coding for it. Those visitors will still see the content, although it will be on the left side of the browser window rather than centered.

Creating rules for Module 1, the header div

The next rules you will tackle are those for the header div, which includes the background image, the navigation list, and the search form.

Adding the header div rules

The first step is to add the background rules that give the header its band that stretches across the entire browser window:

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Advanced as the selector type.
  3. Name the selector #header and click OK.
  4. Select Type from the Category list in the CSS Rule Definition dialog box (see Figure 6).
  5. Select white as the Color.
  6. Select Background from the Category list in the CSS Rule Definition dialog box.
  7. Click Browse and navigate to the header_bg.jpg image in the Blimey images folder.
  8. Select repeat-x from the Repeat pop-up menu.
  9. Set the Background color to #131313.
CSS rule definition for the background properties of the header
Figure 6. CSS rule definition for the background properties of the header
  1. Select Box from the Category list (see Figure 7).
  2. In the Width field, type 100%. Why declare the default width explicitly? In the next step you will be floating the header, and floats work best with an explicit width so that they don't shrink to the width of the content within them.
  3. From the Float pop-up menu, select Left.
  4. Deselect Same for all under Padding.
  5. Type 15 pixels for top and bottom.
  6. Type 0 for right and left.
  7. Click OK.
CSS rule definition for the box properties for the header
Figure 7. CSS rule definition for the box properties for the header

Figure 8 shows what the header looks like at this point.

The header with its background color and image
Figure 8 . The header with its background color and image

Note that the container within the header constrains the content to a fixed region

Adding the header navigation and search rules

Within the header, you are going to write rules to float the navigation list to the left and the search form to the right. To learn more about placing content on opposite sides of a div, refer to Do You Want To Do That With CSS? — Align Elements Left and Right by John Gallant and Holly Bergevin.

The next step is to style the links in the unordered list. To make sure only links within the header div display as horizontal buttons, you need to use descendent selectors. Styles applied to HTML elements such as the ul are global in scope. That is, they apply to every instance of that element on the entire page. To make an HTML element more specific, you can style it within the context of a particular page area such as the header. Thus, a style for #header ul applies only to unordered lists in the header div of the page.

In the steps below, note also of the list-style type. This type removes the bullets from the list so the links look more like buttons.

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Advanced as the selector type.
  3. Name the selector #header ul and click OK.
  4. Select Box from the Category list.
  5. Select Left from the Float menu.
  6. Keep the Same For All option under Padding.
  7. Type 2 pixels.
  8. Select the List category.
  9. Select None from the Type menu.
  10. Click OK.

Styling the list items

The next rule changes the list items from block elements that each appear on a separate line to inline elements that flow side by side. Use the Block category in the CSS Rule Definition dialog box to access the display property:

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Advanced as the selector type.
  3. Name the selector #header li and click OK.
  4. Select the Block category.
  5. From the Display menu, select inline.
  6. Select Box from the Category list (see Figure 9).
  7. Deselect Same for all for the Margin.
  8. Type 0.25 for Right.
  9. Set the Unit of measurement to ems.
  10. Deselect Same For All under Padding.
  11. Type 0.5 em for Bottom.
  12. Click OK.
The Box properties and values for the list items in the header
Figure 9. The Box properties and values for the list items in the header

Styling the navigation links

To complete the header div, you need to finish the visual formatting of the link states, which are also known as pseudo selectors. Use group selectors to format two link states at the same time, and write descendent selectors to ensure that only links in the header div look this way:

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Advanced as the selector type.
  3. Name the selector #header a and click OK.
  4. Select the Type category.
  5. For Size, type 70 and select % (percent) as the unit of measurement.
  6. For Color, select dark gray: #333333.
  7. Under Decoration, select None.
  8. Select the Background category.
  9. Select white in the color picker next to the Background-color field.
  10. Select the Box category.
  11. Deselect Same for all for the Padding.
  12. Type 2 pixels for Top and Bottom.
  13. Type 15 pixels for Right and Left.
  14. Select the Border category.
  15. Leave Same for all selected.
  16. Select Solid for Style.
  17. Type 1 pixel for width.
  18. Type #B5B5B5 for color.
  19. Click OK.
The completed buttons
Figure 10. The completed buttons

Styling the hover and focus states of the links

To style the states of the links, follow these steps:

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Advanced as the selector type.
  3. Name the selector #header a:focus, #header a:hover and click OK.
  4. Select the Type category.
  5. For Color type #B52620, which is the burnt red of the Blimey girl's hair bands.
  6. Click OK.

Do not assign widths to the floats.

Styling the search form

The next steps float the search form on the opposite side of the header container and set the search icon image as a background that displays on the left side. The 25 pixels of padding carve out a space for the image.

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Advanced as the selector type.
  3. Name the selector #search and click OK.
  4. Select the Background category.
  5. Click the Browse button next to the Background image field.
  6. Navigate to search_icon.jpg in the Blimey images folder.
  7. Set its Repeat option to no-repeat.
  8. Set its horizontal position to left.
  9. Set its vertical position to center.
  10. Select the Block category.
  11. Set Text-align to right.
  12. Select the Box category.
  13. Select Right from the Float menu.
  14. Deselect Same For All under Padding.
  15. Type 25 for Left.
  16. Select pixels as the unit of measurement.
  17. Under Margin type 0 (Same for all).
  18. Click OK.

Styling the search label

The next rule, which is another descendent selector, positions the label text off-screen by using absolute positioning to take the element out of the normal document flow. Setting its top coordinate to –10000 moves it off the display area of browser windows.

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Advanced as the selector type.
  3. Name the selector #search label and click OK.
  4. Select the Positioning category (see Figure 11).
  5. From the Type menu, select absolute.
  6. Under Placement type -10000 (a negative value) in the Top field.
  7. Click OK.
Using a negative value to position the search label off-screen
Figure 11 . Using a negative value to position the search label off-screen

The completed header should look like the image shown in Figure 12.

Blimey header complete
Figure 12. Blimey header complete

Creating rules for Module 2, the masthead div

The second module, or mini-layout, includes the masthead logo, as well as a background gradient that spans the entire width of the window.

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Advanced as the selector type.
  3. Name the selector #masthead and click OK.
  4. Select the Background category.
  5. In the Background color field, type #F2F2F2.
  6. Click the Browse button next to the Background image field.
  7. Browse for masthead_bg.jpg in the Blimey images folder.
  8. Set its Repeat option to repeat-x.
  9. Keep Same for all for the Margin.
  10. Type 0.
  11. In the Clear menu, select Both.
  12. Click OK.
Applying the masthead background image
Figure 13. Applying the masthead background image

Image replacement, the p span

The rule for positioning the logo replacement text off-screen uses the same technique as the rule used to position the search label text off-screen.

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Advanced as the selector type.
  3. Name the selector #masthead p span and click OK.
  4. Select the Positioning category.
  5. From the Type menu, select absolute.
  6. Under Placement type -10000 (a negative value) in the Top field.
  7. Click OK.
The masthead with the span text removed from the browser window
Figure 14. The masthead with the span text removed from the browser window

Formatting the columns in the content and footer modules

This is where things get tricky. Many developers like to carve a large left or right margin for a content area and then float a sidebar in the empty space. One problem with this approach is that you can run up against something called the block formatting context.

Block formatting context

You may think of divs as self-contained entities that interact with other areas of the page in completely controlled ways. However, the block formatting context can surprise you. A div by itself is not necessarily an independent object. If you have ever floated an image in the content area of a page and then added a clearing div under it, only to see the floated sidebar area get cleared as well, you know that divs are not always independent.

Figure 15 shows a left-floated image in the content area of the page. The second heading on the page is riding up into the image area. Most designers will add a clearing property to push it down under the image.

Block formatting context problem with a left-floated image
Figure 15. Block formatting context problem with a left-floated image

When you add a clearing property to a layout that has a floated sidebar, the clearing property for the image also clears the floated sidebar, as shown in Figure 16.

Block formatting context problem appears after applying a clearing property to the image.
Figure 16. Block formatting context problem appears after applying a clearing property to the image.

Because using floats is one way to establish a new block formatting context, styling all columns and their wrappers as floats is a great way to structure independent page areas. This technique works particularly well in a fixed-width layout like this one.

Note: Another benefit of using all floats for columns is that it prevents what's referred to as the Internet Explorer 6 three-pixel text-jog bug.

Creating rules for Module 3, the page content

You can use the all-float technique described in the previous section to manipulate the divs in the page content module.

The content-wrapper div

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Advanced as the selector type.
  3. Name the selector #content-wrapper and click OK.
  4. Select the Box category (see Figure 17).
  5. In the Width field, type 770 (px).
  6. From the Float menu, select Left.
  7. Deselect Same for all for the Margin.
  8. Type 20 (pixels) for Bottom.
The box properties and values for the content-wrapper
Figure 17. The box properties and values for the content-wrapper
  1. Select the Border category.
  2. Select solid for Style.
  3. Type 1 (pixel) for Width.
  4. Type #B5B5B5 for Color.
  5. Click OK.

The secondary-content div

Use the following steps to float the secondary content div to the left and give it a width of 250 pixels. The Accordion widget will automatically reduce in width as well. Its default behavior is to take up the entire width of its parent container.

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Advanced as the selector type.
  3. Name the selector #secondary-content and click OK.
  4. Select the Box category (see Figure 18).
  5. In the Width field, type 250 (pixels).
  6. In the Float menu, select Left.
  7. Click OK.
The box properties for the secondary-content div
Figure 18. The box properties for the secondary-content div
The effect of floating the secondary-content div to the left
Figure 19. The effect of floating the secondary-content div to the left

The main-content div

Next, create a rule to float the main-content div to the left and give it a width of 500 pixels. The div will have a left border to serve as a separator between the two columns. In order for this border to continue to the bottom of the content region, the main-content div must be longer. If you need to have short main-content pages, you will need to create a border image that you can place on the content-wrapper div that is the parent of both the secondary and main content divs. You may know this technique as faux columns.

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Advanced as the selector type.
  3. Name the selector #main-content and click OK.
  4. Select the Box category (see Figure 20).
  5. In the Width field, type 500 (pixels).
  6. In the Float menu, select Left.
  7. Deselect Same for all under Padding.
  8. Type 20 (pixels) for Bottom.
The float and width that position the main-content div
Figure 20. The float and width that position the main-content div
  1. Select the Border category.
  2. Deselect Same for all.
  3. Next to Left, select solid for Style.
  4. Type 1 (pixel) for Width.
  5. Type #B5B5B5 for Color.
  6. Click OK.

The main-content h1

This rule styles the h1 element so that it has a decorative background image.

  1. Switch to Split View.
  2. In Code View, locate the opening #main-content div tag.
  3. Position the cursor after this tag and press Enter.
  4. Type The Blog of Blogs.
  5. Place the cursor in front of this text.
  6. Type <h1>.
  7. Place your cursor after this text.
  8. Type </h1> to close the h1 tag.
Heading markup in the main content div
Figure 21. Heading markup in the main content div
  1. Return to Design view.
  2. Click the Plus (+) button to create a new CSS rule.
  3. Select Advanced as the selector type.
  4. Name the selector #main-content h1 and click OK.
  5. Select the Type category.
  6. For Size, type 120 and select % (percent) as the unit of measurement.
  7. For Color, select dark gray: #333333.
  8. From the font-variant menu, select small-caps.
  9. From the Weight menu, select normal.
  10. Select the Background category (see Figure 22).
  11. Next to the Background image field, click the Browse button.
  12. Navigate to the heading_bg.png image in the Blimey images folder.
  13. Set the Repeat option to no-repeat.
Placing the background image on the heading
Figure 22. Placing the background image on the heading
  1. Select the Box category.
  2. Under Padding deselect Same for all.
  3. Set Left padding to 25 (pixels).
  4. Under Margin deselect Same for all.
  5. Set the left margin to 10 (pixels).
  6. Set the top margin to 10 (pixels).
  7. Click OK.
The heading text with a background image to its left
Figure 23. The heading text with a background image to its left
The first three modules previewed in the browser
Figure 24. The first three modules previewed in the browser

Creating rules for Module 4, the footer

You are ready to tackle the final module, the footer. To reinforce the tutorial's lessons about floats, let's proceed in a slightly different way.

The footer div

The footer itself spans the entire width of the browser window. Note that you are not floating this parent div like you did the header div.

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Advanced as the selector type.
  3. Name the selector #footer and click OK.
  4. Select the Type category.
  5. In the Color field, select white: #FFFFFF.
  6. Select the Background category.
  7. In the Background-color field, type #191919.
  8. Select the Box category.
  9. From the Clear menu, select Both.

    Important: This property clears the floats in the content module. Without this property, the footer would display in odd ways.

  10. Deselect Same for all under Padding.
  11. For Top and Bottom type 20 (pixels).
  12. For Right and Left, type 0.
  13. Click OK.
The footer gets its color band
Figure 25. The footer gets its color band

The footer-wrapper div

The footer's border needs to go in a footer wrapper instead of with the columns so that the border continues no matter which column is longest. To give the illusion of equal height columns with borders that extend to the bottom, use the footer_bg.jpg image that you created in the Fireworks comp for this project.

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Advanced as the selector type.
  3. Name the selector #footer-wrapper and click OK.
  4. Select the Background category.
  5. In the Background-color field, type #191919.
  6. Click the Browse button next to the Background image field.
  7. Navigate to footer_bg.png in the Blimey images folder.
  8. Set its Repeat option to repeat-y.
  9. Select the Box category.
  10. In the Width field, type 770 (pixels).
  11. In the Float menu, select Left.
  12. Select the Border category.
  13. Select solid for Style.
  14. Type 1 (pixel) for Width.
  15. Type #B5B5B5 for Color.
  16. Click OK.
. The floated footer-wrapper is not "seen" by the non-floated footer
Figure 26 . The floated footer-wrapper is not "seen" by the non-floated footer

The result probably surprises you unless you remember that you need to use a float clearing method to contain the floated divs within the footer. In the next step, you will use the clearfloat method that is popular with many developers.

The clearfloat class

The clearfloat class rule of the layout is for the br elements you placed in the code before Module 4 and after the closing div for the footer-wrapper and before the closing div for the container. The trick here is to remove anything that causes the break to have dimension:

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Class as the selector type.
  3. Name the selector .clearfloat (don't forget the period) and click OK.

This is the name you gave the class in the markup when you added the br clearing element.

  1. Select Type from the Category list.
  2. Set the font size to 1 pixel.
  3. Set the Line height to 0.
  4. Select Box from the Category list (see Figure 27).
  5. Select Both from the Clear pop-up menu.
  6. Set the height to 0 and click OK.
Creating a clearing widget
Figure 27. Creating a clearing widget

The column divs

To make the columns fit within the inner borders, create a rule that floats the three columns and gives them their width.

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Class as the selector type.
  3. Name the selector .column (don't forget the period) and click OK.
  4. Select the Box category.
  5. In the Width field, type 256 (pixels).
  6. From the Float menu, select Left.
. Each column has a floated column class applied to it
Figure 28 . Each column has a floated column class applied to it.

Note: In Dreamweaver, you will probably see a gray color behind the columns in Design view, although everything will display properly in the browser. Design view does not always render CSS styles perfectly. When in doubt, check the browser, and check as many of them as possible.

The column paragraph styles

This last descendent selector formats the look of paragraphs in the columns. Add a line-height in the Type category to introduce some leading—the space between lines of text. In this instance, it's better not to use a standard unit of measurement because doing so can cause unexpected bugs in the layout. Instead, select Multiple from the Line Height pop-up menu.

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Advanced as the selector type.
  3. Name the selector .column p and click OK.
  4. Select the Type category.
  5. For Size, type 75 (%).
  6. For Line height, type 1.4.
  7. Select Multiple as the unit of measurement.
  8. Select the Box category.
  9. Keep Same for all under Padding.
  10. Type 10 (pixels).
The completed footer
Figure 29. The completed footer

Adding a float class for the image

There is a detail to take care of in the Tab 1 content area: the Blimey girl image sitting at the baseline of the first paragraph of text. Because images are inline elements, they follow the default behavior of such elements to flow one after the other. The image is taller than any letter, so it makes a large space in its row. Adding a float to the image enables the text to wrap around it.

One reason to use a class for this task instead of an ID is that you might want to add other images to the content region. Classes can be used multiple times while IDs must be unique on the page:

  1. Click the Plus (+) button to create a new CSS rule.
  2. Select Class as the selector type.
  3. Name the selector .leftimg (don't forget the period) and click OK.
  4. Select Box from the Category list (see Figure 30).
  5. Select Left from the Float pop-up menu.
  6. Deselect the Same For All option under Margin.
  7. Set the right margin to 8 pixels and click OK. Nothing has happened to the Blimey girl image yet because you must specifically apply the class to it.
Box settings for the image float class
Figure 30. Box settings for the image float class
  1. Select the Blimey girl image.
  2. In the Class pop-up menu of the Property inspector, select the leftimg class that now appears.

The text should now wrap around the image as shown in Figure 31.

Apply the leftimg<strong> </strong>class to the image so the text wraps around it
Figure 31. Apply the leftimg class to the image so the text wraps around it.

Ordering the style sheet

In the heat of creation, you probably added rules in no particular order. This would be a good time to take a "cleansing breath" and bring a little order to the chaos. Dreamweaver CS3 lets you drag and drop rules right in the CSS panel. I like to order my styles according to their place in the source order. There are as many ordering preferences as there are developers, however.

Ordering the rules
Figure 32. Ordering the rules

Using the Spry Accordion styles

As noted in Part 2 of this tutorial, Dreamweaver places dependent files that control the behavior of the Spry widgets in a SpryAssets folder. You can modify the appearance of the widgets by changing properties and values in their style sheets.

In the SpryAssets folder, locate the SpryAccordion.css file for the Accordion widget and open it. The file contains extensive comments that explain the purpose of each rule.

The steps part in this section use the Properties pane of the CSS panel extensively as a quick way to adjust existing properties or to add new ones.

  1. Click the arrow next to the SpryAccordion.css file in the CSS Styles panel to expand it.
  2. Click the first rule, .Accordion (see Figure 33).
  3. Select the border-bottom property.
  4. Click the Trashcan at the bottom of the panel to delete it.
  5. Repeat these steps to delete border-left and border-right as well.
The Properties pane in the CSS Styles Panel
Figure 33. The Properties pane in the CSS Styles Panel

Do not change anything in the .AccordionPanel rule. Skip over that one and move on to the next one, .AccordionPanelTab.

  1. Select .AccordionPanelTab.
  2. In the Properties pane of the CSS Styles panel, change the background-color rule to #EEEEEE (see Figure 34).
  3. Select the border-top property.
  4. Click the Trashcan at the bottom of the panel to delete it.
  5. Change the bottom border color value to #7F7F7F.
Changing the bottom border values
Figure 34. Changing the bottom border values

Do not make any changes to the next rule, .AccordionPanelContent; instead skip to the following rule: .AccordionPanelOpen .AccordionPanelTab.

  1. Select .AccordionPanelOpen .AccordionPanelTab.
  2. Click the Add Property link in the Properties pane of the CSS Styles Panel.
  3. Type background-image (or select the property from the popup menu).
  4. Click the folder next to the value field.
  5. Navigate for acc_bg.jpg in the Blimey images folder.
  6. Add another property.
  7. Type background-repeat (or select it from the menu).
  8. Select repeat-x from the dropdown menu.
  9. Add another property.
  10. Type border-bottom.
  11. Type solid 3px #7F7F7F.
Adding new properties to the Accordion's foreground tab
Figure 35. Adding new properties to the Accordion's foreground tab

The next rule governs the hover color of the Accordion menu text.

  1. Select the .AccordionPanelTabHover class at the top of the CSS Styles panel.
  2. In the Properties pane, change the color from #555555 to #B52620.

    The next two steps apply to the following rules:

    • .AccordionFocused .AccordionPanelTab
    • .AccordionFocused .AccordionPanelOpen .AccordionPanelTab
. The last two rules are set to turquoise
Figure 36 . The last two rules are set to turquoise
  1. Click the hexadecimal color text.
  2. Change the background-color #33CCFF to #EEEEEE.

    Next you will add four new rules to the Accordion style sheet to style the list of links in each Accordion panel.

    Because these rules all start with the .AccordionPanelContent class, an easy way to begin creating them accurately is to click the rule name and copy it to the clipboard.

  3. Click the Plus (+) button to create a new rule.
  4. Paste the class name from the clipboard.
  5. Type a space and then add ul.
  6. Make sure the radio button is set to the Advanced selector type. Descendant selectors go into this Dreamweaver category.
  7. Also make sure that the Defined in option is set to the SpryAccordion style sheet (see Figure 37) and Click OK.
Adding a new descendant selector for the unordered list in the Accordion content area
Figure 37. Adding a new descendant selector for the unordered list in the Accordion content area
  1. Select the Box category.
  2. Add 20 pixels of padding to the top and bottom.
  3. Click OK.
  4. Repeat Steps 1 through 5 to create a new rule for .AccordionPanelContent li.
Creating the list item rule
Figure 38. Creating the list item rule
  1. Select the Background category.
  2. Select the Type category.
  3. Set Size to 95 % (percent).
  4. Next to Background image, click the Browse button.
  5. Navigate to list_bg.png in the Blimey images folder.
  6. Set its Repeat option to no-repeat.
  7. Next to horizontal position, select Left.
  8. Next to vertical position, select Center.
  9. Select the Box category (see Figure 39).
  10. Deselect Same for all under Padding.
  11. Set the padding to 0 top, 0 right, 5 pixels bottom, and 25 pixels left.
Setting the padding values so that the arrow background image displays properly
Figure 39. Setting the padding values so that the arrow background image displays properly
  1. Select the List category.
  2. Set Type to none.
  3. Click OK.
  4. Repeat Steps 1 through 5 to create a new rule named .AccordionPanelContent a.
  5. Select the Type category.
  6. Set the Color to #333333 (dark gray).
  7. Set Decoration to none.
  8. Click OK.
  9. Repeat Steps 1 through 5 to create a new rule named .AccordionPanelContent a:hover.
  10. Select the Type category.
  11. Set the Color to #B52620.
  12. Click OK.

Figure 40 shows the completed Accordion widget.

The completed Accordion panel
Figure 40. The completed Accordion panel

Using the Tabbed Panel widget

The Tabbed Panel widget requires fewer style changes because it does not involve navigation. The first two rules are fine as they are; so start with the .TabbedPanelsTab rule:

  1. Select the .tabbedPanelsTab rule in the top part of the CSS Styles panel.
  2. In the Properties panel, delete the border-bottom property and values.
  3. Click the arrow to close SpryAccordion.css in the CSS Styles panel.
  4. Click the arrow to open SpryTabbedPanels.css.
  5. Select .TabbedPanelsTabHover.
  6. In the Properties panel, click the Add Property link.
  7. Type Color (or select it from the contextual list of properties).
  8. Type the value #B52620.
  9. Select the .TabbedPanelsTabSelected rule.
  10. In the Properties panel, change background-color to white (#FFFFFF).
  11. Change the border-bottom color value to #B5B5B5.
  12. Click the Add Property link.
  13. Type background-image (or select it from the contextual menu).
  14. Click the folder and browse to tab_bg.jpg in the Blimey images folder.
  15. Click the Add Property link.
  16. Type background-repeat.
  17. Select repeat-x from the pop-up menu.
Changing properties and values for .TabbedPanelsTabSelected
Figure 41. Changing properties and values for .TabbedPanelsTabSelected
  1. Select the .TabbedPanelsContentGroup rule.
  2. Change background-color to #FFFFFF.
  3. Remove all borders except for the top border.
  4. Change the top border color to #B5B5B5.
. Adjusting the .TabbedPanelsContentGroup rule
Figure 42 . Adjusting the .TabbedPanelsContentGroup rule
  1. Select the .TabbedPanelsContentVisible rule.
  2. Click the Plus (+) button at the bottom of the CSS Styles Panel to create a new rule.
  3. Type .TabbedPanelsContentVisible p as the selector name.
  4. Click the Advanced radio button for selector type.
  5. Make the sure the new rule is defined in the SpryTabbedPanels.css file.
Adding a paragraph style for visible content
Figure 43. Adding a paragraph style for visible content
  1. Click OK.
  2. Select the Type category.
  3. For Size type 85% (percent).
  4. For Line height type 1.4.
  5. Select Multiple as the unit of measurement.
  6. Select the Box category.
  7. Deselect Same for all under Padding.
  8. Type 8 pixels in the field for Left.
  9. Click OK.
The styled Spry widgets
Figure 44. The styled Spry widgets
The complete Blimey Design comp
Figure 45. The complete Blimey Design comp

Congratulations! The layout is now complete, and the client should be satisfied because you took a Fireworks comp and translated it quite precisely into code in Dreamweaver. There are still a few tasks, including checking for browser compatibility, that you might want to complete in the interest of thoroughness, however. Dreamweaver CS3 makes this easy with its new feature, the Check Browser Compatibility page check.

Checking browser compatibility

The goal for this layout is to keep hacks to a minimum. Indeed, if you were to do a page check, you would find that there are no serious issues.

  1. Click the Check Page button on the right side of the Document toolbar.
  2. Select Check Browser Compatibility. Dreamweaver will run a script on the page that looks at how you coded the CSS. It will identify known bugs and present them to you in the Results panel.
Running the new Check Page > Check Browser Compatibility feature on the layout.
Figure 46. Running the new Check Page > Check Browser Compatibility feature on the layout.
The Results panel reports that the page has no issues.
Figure 47. The Results panel reports that the page has no issues.

What the results panel does not show, however, is that there are a few discrepancies in the appearance of the page when it is viewed with Internet Explorer 5. If you need to support the various version 5 upgrades of Internet Explorer, you can tweak the page with a centering fix (as described earlier in this tutorial) and add a rule to address the fact that the header links don't display as buttons the way they do in more standards-compliant browsers.

If you decide that the Internet Explorer 5 audience is too small for you to worry about, leave this small, cosmetic issue alone. If you want the navigation to look identical in this older browser, however, you can add the following code to the head of the document after the link to the style sheet:

<!--[if IE 5]> <style type="text/css"> #header a,#header a:focus, #header a:hover; { height: 1%; vertical-align: bottom; } </style> <![endif]-->

Conditional comments appear within HTML comments and include a conditional statement—or if statement—that looks for a particular version or range of versions of Internet Explorer. If the version is found, a custom rule is served to that browser. In this case, adding a dimension and vertical alignment to the navigation links fixes the spacing problem.

A full discussion about conditional comments is beyond the scope of this tutorial, but you can read more about them in the Conditional Comments posting on Peter-Paul Koch's QuirksMode blog. You can also read more about the list display problems in Internet Explorer in List Display Problems in Explorer for Windows – Part 1 on Community MX.

Where to go from here

Now you know how to think in terms of CSS at every step of the web page development process—from starting layout comps in Fireworks to completing the pages in Dreamweaver. If you encounter any problems with your CSS or markup while following this tutorial series, compare your code with the completed examples included in the tutorial sample files. You can also study the CSS comments after each property and value in the blimey.css sample document. CSS comments begin and end with a slash and asterisk combination (/* and */). Commenting is a best practice that helps team members understand the thinking of other members on the team. They can also help solo designers recall their own thought processes. For example, six months later a comment may help a designer remember the purpose of a particular property.

Another troubleshooting method is to make sure that the page validates for markup, CSS, and accessibility. Checking these critical factors using the free Firefox Web Developer Toolbar quickly reveals problems and gives you clues about how to fix them.

You can also validate your markup and validate your style sheet at the World Wide Web Consortium (W3C) website.

For more information about CSS, visit the CSS topic page in the Dreamweaver Developer Center.

More Like This

  • Responsive design with jQuery marquee
  • Understanding HTML5 semantics – Part 2: Document structure and global attributes
  • Using Modernizr to detect HTML5 and CSS3 browser support
  • Customizable starter design for jQuery Mobile
  • Customizable starter design for HTML5 video
  • Dreamweaver CS5 Missing Manual excerpts: Behaviors, site management, and templates
  • Using and customizing jQuery Mobile themes
  • Customizable starter design for multiscreen development
  • Building Drupal Zen subthemes with Dreamweaver CS4
  • Marking up your site for easier redesign in five steps

Tutorials and samples

Tutorials

  • Understanding HTML5 semantics: Changed and absent elements
  • Mobile app with PhoneGap: Submitting to the Apple App Store
  • PhoneGap and Dreamweaver: Releasing on iOS
  • Mobile app with PhoneGap: Submitting to Android Market

Samples

  • Responsive design with jQuery marquee
  • Customizable starter design for jQuery Mobile
  • Customizable starter design for HTML5 video
  • Customizable starter design for multiscreen development

Dreamweaver user forum

More
04/23/2012 Resolution/Compatibility/liquid layout
04/20/2012 using local/testing server with cs5 inserting images look fine in the split screen but do not show
04/18/2012 Ap Div help
04/23/2012 Updating

Dreamweaver Cookbook

More
11/07/2011 Simple social networking share buttons
09/20/2011 Registration form that will generate email for registrant to validate
08/21/2011 Spry Accordion - Vertical Text - Auto Start on Page Load - Mouse Over Pause
08/17/2011 Using cfdump anywhere you like

Products

  • Acrobat
  • Creative Cloud
  • Creative Suite
  • Digital Marketing Suite
  • Digital Publishing Suite
  • Elements
  • Mobile Apps
  • Photoshop
  • Touch Apps
  • Student and Teacher Editions

Solutions

  • Digital marketing
  • Digital media
  • Web Experience Management

Industries

  • Education
  • Financial services
  • Government

Help

  • Product help centers
  • Orders and returns
  • Downloading and installing
  • My Adobe

Learning

  • Adobe Developer Connection
  • Adobe TV
  • Training and certification
  • Forums
  • Design Center

Ways to buy

  • For personal and home office
  • For students, educators, and staff
  • For small and medium businesses
  • For businesses, schools, and government
  • Special offers

Downloads

  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR
  • Adobe Shockwave Player

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2012 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy Policy and Cookies (Updated)

Ad Choices

Reviewed by TRUSTe: site privacy statement