Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

How do I center my design in Dreamweaver?

I have a design that I want to center in the browser window and don't know CSS.

This is a website I have done that uses absolute positioning, but I'd like for it all to be centered. Is there a way to do this easily or would I have to redesign everything in CSS?

(Please ignore the obnoxious resizing of the browser window).

www.robcolvin.com

5 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    None of the answers above will work cross-browser (sorry guys).

    If you centre align it now, the divs you have used will stay where they are because you used absolute positioning, so yes, you would have to redo it all.

    Sorry it's not good news.

  • Anonymous
    1 decade ago

    Thumbs up to Micky. As stated, dump the absolute positioning. Hard to center anything when it is told to stay fixed relative to the browser's window size.

    To center anything, the width set must be less than 100%. Then the following CSS property can be used:

    margin: 0 auto;

    That doesn't preclude you from setting a top/bottom margin value with that property. "0" is the top/bottom margin setting.

    See:

    Positioning is Everything: http://www.positioniseverything.net/

    In Search of the Holy Grail: http://www.alistapart.com/articles/holygrail/

    Ron

  • Anonymous
    1 decade ago

    If you do not want to figure out, you can try:

    <center> ...CONTENT ... </center>

    However, some aspects of a web page may mess it up, but it is worth a try.

    Other than that, if you want, a similar affect like <center> is to simply add this into your <style ...> section in your <head>

    <head>

    <style type='text/css' rel='stylesheet'>

    body {

    margin-left: auto;

    margin-right: auto;

    }

    </style>

    </head>

    Good Luck!

    If you need further assistance/advice, feel free to contact me.

  • 1 decade ago

    The trick is to use CSS to choose your width and then set the margins to auto. Se code below.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitiona...

    <html xmlns="http://www.w3.org/1999/xhtml%22%3E

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Centered Layout</title>

    <style type="text/css">

    <!--

    #centered_style {

    margin: auto;

    width: 800px;

    border: medium dotted #FF0066;

    border: medium dotted #FF0066;

    margin: auto;

    }

    -->

    </style>

    </head>

    <body>

    <!-- Here is where the id is applied -->

    <div id="centered_style">Content for New Div Tag Goes Here</div>

    </body>

    </html>

  • How do you think about the answers? You can sign in to vote the answer.
  • 1 decade ago

    before your container or main CSS div in your html, write:

    <div align="center"> <div id="what ever your main div is"> <div align="left">

    This should help it. If not, or any other problems, kevinwcaulfield@yahoo.com

    Source(s): I make websites.
Still have questions? Get your answers by asking now.