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 /

Designing with CSS – Part 4: Styling headers and main content

by Adrian Senior

Adrian Senior
  • www.webade.co.uk
  • www.communitymx.com
  • www.ukcsstraining.co.uk

Created

16 April 2007

Page tools

Share on Facebook
Share on Twitter
Share on LinkedIn
Bookmark
Print
best practice CSS Dreamweaver CS3 Dreamweaver CS4 website

Requirements

Prerequisite knowledge

This tutorial focuses on customizing the look of web content using Dreamweaver CS3 and Fireworks CS3 and assumes you are familiar with working with both Internet Explorer and Firefox browsers. This is Part 4 of a six-part tutorial series—be sure to review Part 3 of this tutorial to review the topics discussed in that section before continuing.

User level

Beginning

Required products

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

Tutorials and sample files

  • css4_samples.zip (248 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 is the fourth part of a six-part tutorial series on CSS design concepts. If you missed any of the previous sections, it may be helpful for you to review them to become familiar with the concepts previously discussed before beginning this part:

  • Part 1: Understanding CSS design concepts
  • Part 2: Defining style properties and working with floats
  • Part 3: Using CSS Positioning for site layout

In Part 3, we analyzed the page layout design to see how it is constructed with div elements to wrap the outer "container" and create a sidebar area. We discovered how different elements within the design work together to ensure that the design remains readable and can be resized by the user as desired.

This part of the tutorial series covers the next phase in our project—styling the header and main content areas using the features available in Dreamweaver CS3.

Controlling the look of the header content

In this article, we’ll create an image for the header area of the page and we’ll blend the color to match the background color of the header div element. As we look at the work we’ve done so far, one very important part of the website is missing—a navigation system. We’ll address that shortly. First, we’ll create the header image. Download the sample files that are provide at the beginning of this tutorial, if you haven’t already. Uncompress the ZIP file, and then open the bmwHeader image in Fireworks CS3, (see Figure 1).

Fireworks screen shot
Figure 1. Open the bmwHeader image file in Fireworks CS3

First, we’ll increase the canvas size to the right of the image; this is the area we will fade out, using the fade image command.

  • Play the demo: Fading the header image

Here are the steps reviewed in the demo:

  1. Launch Fireworks and open the image file bmwHeader.jpg.
  2. Select Modify > Canvas Size.
  3. In the Canvas Size dialog box, select the center left square to indicate that the added width will expand the canvas to the left side of the image.
  4. In the width field, enter 320 and check that the measurement is set to pixels.
  5. Click OK.
  6. Select Modify > Canvas color and select the Custom color option.
  7. Click the color picker to access the eyedropper tool. Choose a blue color from the car image. In the demo, the hexadecimal value used is: #4467A7
  8. Click OK.
  9. Select Commands > Creative > Fade Image
  10. In the Fade Image dialog box, select the left to right fade, in the second left top row.
  11. Use the gradient bar to adjust the fade until it looks smooth
  12. Save the image file: bmwHeader.jpg.
  13. Select File > Image Preview
  14. Specify optimization settings, as desired. Click Export.
  15. Save the image, overriding the existing image in the sample files folder.

At this point, the image file is ready to be displayed in the header area.

Setting the image and changing the header’s background color

Launch Dreamweaver and open index.html (the file we’ve been working with) or alternately download the sample files and use the provided index page. Set the Document window to the Design view, if it is not already.

  • Play the demo: Modifying the header

Here are the steps reviewed in the demo:

  1. Place the cursor inside the header text.
  2. In the Quick Tag Selector, click h1 to select the header.
  3. When selected, the header will be highlighted.
  4. Press the Delete key to remove the header text.
  5. From the Insert bar, select the Image button.
  6. In the Insert Image dialog box, navigate to select the header image: bmwHeader.jpg.
  7. In the Image Tag Accessibility dialog box, add the alt text for the header image.
  8. Click OK
  9. The image is now inserted in the header area of the page.
  10. The gap to the left of the image is caused by the padding values set on the header.
  11. Open the CSS Styles panel and click the All button at the top.
  12. Select the .twoColElsLHdr rule for the header, and then expand the Box property.
  13. Select the padding property and click the Delete CSS Style button.
  14. In the Document window, click in the Design view to refresh the page content.
  15. The header image moves to the left and the extra space disappears.
  16. In the CSS Styles panel, select the Background property.
  17. Click the color chip to select a background color
  18. From the color swatches, choose a blue canvas color
  19. After making this selection, the header div displays as blue
  20. In the CSS Styles panel, expand the Border property
  21. Add a bottom border to the header div by selecting the bottom border color using the color cube. Select black.
  22. In the drop-down menu for the bottom border, choose the solid option.
  23. In the drop-down menu for the bottom border width, select the thin option.
  24. Click on index.htm in Design view to refresh the page content.
  25. The header div element displays the bottom border based on the applied settings, (see Figure 2).
  26. Save the CSS file.
  27. Choose File > Preview in Browser to review your work.
Browser screen shot
Figure 2. After using the Fade command and setting the bottom border, the header element should display like the one above

The new CSS layout templates provided with Dreamweaver CS3 are very useful, and will save you valuable time. Use the layouts to start from scratch as you build new projects, or analyze the code to better understand how CSS can be used to control and improve the look and feel of your page designs.

Styling the main content

The header looks great as it fades into the background; so let’s proceed to the next step—styling the main content. In the next part of this tutorial series, we’ll focus on the sidebar element content and adding the navigation bar. For the upcoming exercise, we’ll concentrate on the main content area. We’ll take a look at how we can improve the color palette, and we’ll also see how we adjust the spacing to make the content look better.

  • Play the demo: Adjusting the main content with CSS styling

Here are the steps reviewed in the demo:

  1. Launch Dreamweaver and open index.html. Set the Document window to Design view, if it is not already.
  2. In the CSS Styles panel, click the All button to see all styles.
  3. Select the CSS rule for the mainContent element in .twoColElsLtHdr for #container.
  4. Expand the Box property and select the top margin property.
  5. In the drop-down menu next to width, enter: 1.
  6. As the unit of measurement, select ems
  7. Select the Font property and use the eyedropper tool to select a dark gray / blue color. In the demo, the hexadecimal value used is: #393B4A.
  8. Scroll down to the h2 level heading
  9. Select the CSS rule for the mainContent #container in .twoColElsLtHdr
  10. Expand the Font property, and use the color picker to get the eyedropper tool.
  11. Select a color from the h1 title.
  12. Select the P rule listed in the CSS Styles panel
  13. Expand the Font property and click the color cube to access the eyedropper tool. Select a color from the h1 color.
  14. Adjust the color to display P elements, to make them lighter
  15. By lightening the P element color, you ensure that the headings are always darker than the main content text.
  16. Save the CSS file.

We’ve now completed the styling for the header and the main content area.

In part five of this series we’ll create a navigation bar in the left side area. We’ll also find out how easy it is to manipulate a CSS layout when a site client is fond of last minute changes.

Where to go from here

After exploring with setting different font colors and background colors for main content areas, try adding borders with various settings to the elements within your page. Once you are comfortable with the steps covered here, continue onward with part five of this tutorial series.

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
  • Marking up your site for easier redesign in five steps
  • Getting Started with CSS excerpts: Styling tables, backgrounds, and borders

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: Creating a release build for Android

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