How to Make Website Center With Div Tags in Dreamweaver

Written by jason whitaker
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Make Website Center With Div Tags in Dreamweaver
You can centre a web page using a DIV container and CSS. (Comstock/Comstock/Getty Images)

Dreamweaver is a powerful tool for both experienced and inexperienced web designers. One common design issue that Dreamweaver does not address with its embedded tools is the ability to centre a DIV container on a page. Using a series of inline styling elements, you can control a DIV container's width and position on a page. The following is a step by step process to adding the appropriate CSS to a DIV container in order to centre a website using Dreamweaver.

Skill level:

Other People Are Reading


  1. 1

    Locate the DIV container that contains all of the contents of your web page. Create a new DIV container if one does not already exist.

  2. 2

    Add a style=" " tag to the DIV container to hold your new styling elements:

    <div style=" ">

  3. 3

    Add a set width to the DIV container inside of the style tag. Assign a value sufficient enough to hold the entire contents of the web page. Set your value in either percentages or in pixels:

    <div style="width: 25px;">

  4. 4

    Set your DIV container's right and left margins to "auto":

    <div style="width: 25px; margin-right: auto; margin-left: auto;">

  5. 5

    Create a closing </div> tag at the end of the web page's contents if you were creating a new DIV container from scratch.

Tips and warnings

  • The auto margin styling only works with DIV containers that have a set width.
  • If you are using a separate cascading stylesheet, you can add these styling elements there rather than placing them inline on your web page.
  • Be sure to check your web page's appearance in several web browsers, including Internet Explorer, Firefox, and Safari.
  • Do not use the tag or text-align styling element to try to centre a web page.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.