Layout with Layers and CSS
Today we're going to make a Web site layout very much like the one used for nhsdesigns.com.
Preparatory Step
- View the page source for this page to see the HTML code (right-click in the page and select View Page Source.)
- Take a look at the source. Does this page use any tables? If not, how did it manage to have all these separate sections?
- Create a folder called firstnamelastinitial_csslayers.
- Create an assets folder inside of this folder.
- Open Dreamweaver.
Step One: Create the Body
First, we'll set up a gray background behind it all, and set the font style.
- Create a new, blank HTML document in Dreamweaver.
- Save the file as index.html inside your CSS Layers folder.
- In the Document tool bar, change the Title to CSS Layers.
- Show the CSS Styles panel (located in the Design panel) and click on the New CSS Rule icon. Use these settings and click OK:
- Tag: body
- Selector Type: Tag
- Define in: (New Style Sheet File)
- Save the style sheet file as main.css in your CSS Layers folder.
- In the CSS Rule definition for body box, use these settings and click OK:
Category |
Setting |
Value |
|---|---|---|
Type |
Font |
Verdana, Arial, Helvetica, sans serif |
Size |
10 pixels |
|
Color |
#000000 |
|
Background |
Background color: |
#cccccc |
- Save both files (File > Save All), and with index.html active press F12 to view the page in a browser. It should look like this:

Step Two: Create the Outer Container
Next, we'll create the large white rectangle that contains everything else. Using this layer outside of the layer in step three will create a nice, 15-pixel white border.
- Click inside the page.
- In the CSS Styles panel, click on the New CSS Style icon.
- In the New CSS Rule box, use these setting and click OK:
- Tag: #container
- Selector Type: Advanced
- Define in: main.css
- In the CSS Rule definition for #container box, use these settings and click OK twice:
Category |
Subcat. |
Setting |
Value |
|---|---|---|---|
Background
|
Background color: |
#ffffff |
|
Box |
Width |
720 pixels |
|
Padding (UNCHECK same for all) |
Top |
0 |
|
Margin (UNCHECK same for all) |
Top |
0 |
|
Right |
Auto |
||
Bottom |
0 |
||
Left |
Auto |
||
Border (same for all) |
Style |
solid |
|
Width |
15 pixels |
||
Color |
#ffffff |
||
- Choose the following menu command: Insert > Layout Objects > Div Tag.
- In the dialog box, select ID: container.
- Save both files (File > Save All), and with index.html active press F12 to view the page in a browser. It should look like this:

Step Three: Create the Header
Here we'll create a header area in which a banner image could go later. It will have a baby blue background and have a 1-pixel white bottom border.
- Click inside the #container layer. Delete the text that automatically filled the layer but leave your cursor inside the layer.
- In the CSS Styles panel, click on the New CSS Style icon.
- In the New CSS Rule box, use these setting and click OK:
- Tag: #header
- Selector Type: Advanced
- Define in: main.css
- In the CSS Rule definition for #header box, use these settings and click OK twice:
Category |
Subcat. |
Setting |
Value |
|---|---|---|---|
Background
|
Background color: |
#22b5ff |
|
Box
|
Width |
720 pixels |
|
Height |
220 pixels |
||
Border (UNCHECK same for all in all 3 columns) |
Bottom |
Style |
solid |
Width |
1 pixel |
||
Color |
#ffffff |
||
- Let's use a shortcut to insert the Div tag:
- In the Insert Bar, change the dropdown to Layout.
- Click on the Insert Div Tag icon (the second one.)
- In the dialog box, select ID: header.
- Save both files (File > Save All), and with index.html active press F12 to view the page in a browser. It should look like this:

Step Four: Create the Navigation Area
We need a rectangle below the banner for links. It will have a dark blue background and white text. It will also have a 1-pixel white bottom border, and 10 pixels of padding around its text. First, we need to tell Dreamweaver precisely where to put it by viewing the code.
- Click on the Code button on the Document tool bar.
- Find this bit of code and click just before it:
</div>
</body>
</html> - Click on the Design button on the Document tool bar.
- In the CSS Styles panel, click on the New CSS Style icon.
- In the New CSS Rule box, use these setting and click OK:
- Tag: #navigation
- Selector Type: Advanced
- Define in: main.css
- In the CSS Rule definition for #navigation box, use these settings and click OK twice:
Category |
Subcat. |
Setting |
Value |
|---|---|---|---|
Type |
Color |
#ffffff |
|
Background
|
Background color: |
#005ac9 |
|
Box
|
Width |
700 pixels |
|
Height |
20 pixels |
||
Border (UNCHECK same for all in all 3 columns) |
Bottom |
Style |
solid |
Width |
1 pixel |
||
Color |
#ffffff |
||
- In the Insert Bar, click on the Insert Div Tag icon.
- In the dialog box, select ID: navigation.
- Save both files (File > Save All), and with index.html active press F12 to view the page in a browser. It should look like this:

Step Five: Create the Lower Container
Now we'll create the main content rectangle. It won't be visible by itself, but it is necessary as a frame for the multi-colored columns.
- Click on the Code button on the Document tool bar.
- Find this bit of code and click just before it:
</div>
</body>
</html> - Click on the Design button on the Document tool bar.
- In the CSS Styles panel, click on the New CSS Style icon.
- In the New CSS Rule box, use these setting and click OK:
- Tag: #local-container
- Selector Type: Advanced
- Define in: main.css
- In the CSS Rule definition for #local-container box, use these settings and click OK twice:
Category |
Setting |
Value |
|---|---|---|
Type |
Color |
#000000 |
Box |
Width |
720 pixels |
Positioning |
Type |
relative |
- In the Insert Bar, click on the Insert Div Tag icon.
- In the dialog box, select ID: local-container.
- Save both files (File > Save All), and with index.html active press F12 to view the page in a browser. It should look like this:

Step Six: Create the Left-Hand Column
We'll create three columns for the content. The first column will be for sidebar information. It has a grass green background, 10 pixels of padding around its text, and a 1-pixel white border on its right side. We need to tell it to float left because we will be putting layers side-by-side here rather than one atop the other.
- Click inside the local-container layer and delete the text there. Leave your cursor inside the layer.
- In the CSS Styles panel, click on the New CSS Style icon.
- In the New CSS Rule box, use these setting and click OK:
- Tag: #left
- Selector Type: Advanced
- Define in: main.css
- In the CSS Rule definition for #left box, use these settings and click OK twice:
Category |
Subcat. |
Setting |
Value |
|---|---|---|---|
Background |
Background color |
#9cff00 |
|
Box |
Width |
150 pixels |
|
Float |
Left |
||
|
Padding (Same for all) |
Top |
10 |
Border (UNCHECK same for all for all 3 columns) |
Right |
Style |
solid |
Width |
1 pixel |
||
Color |
#ffffff |
||
- In the Insert Bar, click on the Insert Div Tag icon.
- In the dialog box, select ID: left.
- Save both files (File > Save All), and with index.html active press F12 to view the page in a browser. It should look like this:

Step Seven: Create the Center Column
This column will contain the main content. It has a white background, 10 pixels of text padding, and 1-pixel white borders on the top and bottom. It also needs to float left.
- Click on the Code button on the Document tool bar.
- Find this bit of code and click just after it:
<div id="left">Content for id "left" Goes Here</div> - Click on the Design button on the Document tool bar.
- In the CSS Styles panel, click on the New CSS Style icon.
- In the New CSS Rule box, use these setting and click OK:
- Tag: #center
- Selector Type: Advanced
- Define in: main.css
- In the CSS Rule definition for #center box, use these settings and click OK twice:
Category |
Subcat. |
Setting |
Value |
|---|---|---|---|
Background
|
Background color: |
#ffffff |
|
Box
|
Width |
358 pixels |
|
Float |
Left |
||
Padding (same for all) |
Top |
10 |
|
Border (UNCHECK same for all in all 3 columns)
|
Top |
Style |
solid |
Width |
1 pixel |
||
Color |
#ffffff |
||
Bottom |
Style |
solid |
|
Width |
1 pixel |
||
Color |
#ffffff |
||
- In the Insert Bar, click on the Insert Div Tag icon.
- In the dialog box, select ID: center.
- Save both files (File > Save All), and with index.html active press F12 to view the page in a browser. It should look like this:

Step Eight: Create the Right Column
This last column will be for secondary navigation.
- Click on the Code button on the Document tool bar.
- Find this bit of code and click just after it:
<div id="center">Content for id "center" Goes Here</div> - Click on the Design button on the Document tool bar.
- In the CSS Styles panel, click on the New CSS Style icon.
- In the New CSS Rule box, use these setting and click OK:
- Tag: #right
- Selector Type: Advanced
- Define in: main.css
- In the CSS Rule definition for #right box, use these settings and click OK twice:
Category |
Subcat. |
Setting |
Value |
|---|---|---|---|
Background |
Background color |
#22ffd8 |
|
Box |
Width |
150 pixels |
|
Float |
Left |
||
|
Padding (Same for all) |
Top |
10 |
Border (UNCHECK same for all for all 3 columns) |
Left |
Style |
solid |
Width |
1 pixel |
||
Color |
#ffffff |
||
- In the Insert Bar, click on the Insert Div Tag icon.
- In the dialog box, select ID: right .
- Save both files (File > Save All), and with index.html active press F12 to view the page in a browser. It should look like this.

Step Nine: Create the Footer
Finally, we'll put a nice bottom rectangle to allow for copyright information and other small notations and links. It has the same white text and dark blue background as the navigation bar, 10 pixels of text padding, and 1-pixel white borders on the top and bottom.
- Click on the Code button on the Document tool bar.
- Find this bit of code and click just before it:
</div>
</body>
</html> - Click on the Design button on the Document tool bar.
- In the CSS Styles panel, click on the New CSS Style icon.
- In the New CSS Rule box, use these setting and click OK:
- Tag: #footer
- Selector Type: Advanced
- Define in: main.css
- In the CSS Rule definition for #footer box, use these settings and click OK twice:
Category |
Subcat. |
Setting |
Value |
|---|---|---|---|
Type |
Color |
#ffffff |
|
Background
|
Background color: |
#005ac9 |
|
Box
|
Width |
700 pixels |
|
Height |
40 pixels |
||
Float |
Left |
||
Padding (same for all) |
Top |
10 |
|
Border (UNCHECK same for all in all 3 columns)
|
Top |
Style |
solid |
Width |
1 pixel |
||
Color |
#ffffff |
||
Bottom |
Style |
solid |
|
Width |
1 pixel |
||
Color |
#ffffff |
||
- In the Insert Bar, click on the Insert Div Tag icon.
- In the dialog box, select ID: footer.
- Save both files (File > Save All), and with index.html active press F12 to view the page in a browser. It should look like this:

Step Ten: Cleaning up the Footer Issue
This site design is nice but it has a couple of layout flaws. Sometimes we need to do a dreaded "CSS Hack" to get a CSS site to behave the way we want.
Let's look at what's wrong:
- Click inside the center column and press Enter about ten times.
- Click inside the left column and press Enter twice.
- Notice that the green and teal columns do not expand along with the center column.
- Select the menu command File > Preview in Browser > Firefox.
- Notice that in Firefox not even the footer moved down. It wants to stay up high. It is better behaved in Internet Explorer, but we need it to work in all major browsers.
Firefox:

Internet Explorer:

First, we need a horizontal rule to push that footer down, and we need it to be invisible.
- In the CSS Styles panel, click on the New CSS Rule icon. Use these settings and click OK:
- Tag: clear
- Selector Type: Class
- Define in: main.css
- In the CSS Rule definition for .clear box, use these settings and click OK:
Category |
Setting |
Value |
|---|---|---|
Block |
Display |
Block |
Box |
Clear |
Left |
Positioning |
Visibility |
Hidden |
- Click on the Code button on the Document tool bar.
- Find this bit of code and click just after it:
<div id="right">Content for id "right" Goes Here</div> - Click on the Design button on the Document tool bar.
- On the Insert Bar, select HTML from the dropdown menu.
- Click on the first icon for Horizontal Rule.
- In the Property Inspector, set the Class to clear.
- Save both files (File > Save All), and with index.html active press F12 to view the page in a browser. It should look like this:

Step Eleven: Color Fill
That does a nice job of pushing that footer down. Now all we need to do is use a background image in the #container layer to give the impression that the left and right columns are going all the way down too.
- Add the 3-column background image to your site files. Right click on the link below and save the image into your assets folder:
bg-image.gif - In the CSS Styles panel, select the #container style and click the Edit Style Sheet... icon.
- Go to the Background section and click on the Browse button next to Background Image.
- Navigate to bg-image.gif inside your assets folder and click OK.
- Save both files (File > Save All), and with index.html active press F12 to view the page in a browser.
- Go back to Dreamweaver and look at all the HTML and CSS code you created in Dreamweaver.
- Bring index.html up front by clicking on its tab. Click on the Code button on the Document tool bar. Find the various DIV tags which tell the layers where to go. HTML is used for STRUCTURE.
- Bring main.css up front by lciking on its tab. Notice how the CSS tells the layers what size to be, what to look like and how to behave. CSS is used for PRESENTATION.

