Skip navigation
Currently Being Moderated

How can center my webpage. It is shifted to the left.

Feb 3, 2013 12:09 PM

Hi all, Wondering if you can help. My question is elementary, I know. But I cannot figure out how to get my webpage to be centered when I look at it on live view or go through the web. So I know it will appear cockeyed to anyone viewing the page. Thanks!

 
Replies
  • Currently Being Moderated
    Feb 3, 2013 12:17 PM   in reply to Prazzle

    You need just 3 things to center a page:

    1. a valid document type declaration in your HTML.  Good news is that DW does this for you when you create a new document.
    2. an expressed CSS width in pixels, % or ems.
    3. a CSS margin-left and margin-right of "auto" (browser's default).

     

    NOTE: This will not work with APDivs because they are removed from the normal document flow.

     

    CSS:

     

    body {

    width: 1000px;

    margin: 0 auto;

     

     

    If you're hell bent on using APDivs for primary layouts (and you shouldn't by the way), you will need to wrap them inside a relatively positioned parent container like so:

     

    body {

    width: 1000px;

    margin: 0 auto;

    position:relative;

     

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 4, 2013 4:02 PM   in reply to Prazzle

    DW does not automatically center anything for you.  You need all 3 elements I mentioned above and possibly the 4th if you're using APDivs for your layout.

     

    If you still need help, please provide a link to your site so we can look at it.

     

    Nancy O.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 9, 2013 4:09 PM   in reply to Prazzle

    Let's see your code (HTML & CSS).

     

    Nancy O.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points