How to create an always-centered container div in CSS and Dreamweaver CS4

How to create an always-centered container div in CSS and Dreamweaver CS4

Step 1

Open a new HTML document in Dreamweaver

14 How to create an always centered container div in CSS and Dreamweaver CS4

Step 2

In the CSS panel / window create a new CSS rule.
If you can’t see the CSS panel, you’ll find it under the Window menu, it is the 3rd item on the menu.
21 How to create an always centered container div in CSS and Dreamweaver CS4

Step 3

Name the CSS rule and click OK.

Step 4

In the rules window (that’s just opened) choose “Box”  from the  category menu on the left and in the margin options un-click same for all. Set the Right Margin and Left margin to Auto.
31 How to create an always centered container div in CSS and Dreamweaver CS4
41 How to create an always centered container div in CSS and Dreamweaver CS4

Step 5

Now turn back to to the HTML document you created, for now it is essentially empty from any code (aside for the defalt code DW generates when opening the document). In the insert menu click on Insert Div tag. Assign it the rule you created (in the top field) and give it an I.D. (in the bottom field) and presto, you have an always-centered container div. This is how the div will look in Design mode once you click on its edges:

4a How to create an always centered container div in CSS and Dreamweaver CS4
4b How to create an always centered container div in CSS and Dreamweaver CS4
This is how the end product should look:

5 How to create an always centered container div in CSS and Dreamweaver CS4



Leave a Reply

Get Adobe Flash playerPlugin by wpburn.com wordpress themes