www.webdeveloper.com
Results 1 to 5 of 5

Thread: Centre Page?

  1. #1
    Join Date
    Aug 2010
    Posts
    53

    Centre Page?

    How do i centre the page?

  2. #2
    Join Date
    Sep 2008
    Location
    Akron, OH
    Posts
    1,111
    Code for a centered div:

    Code:
    <div style="width: 400px; height: 400px; background: #f00; margin: 0 auto;">
    </div>
    The key is "margin: 0 auto;"

  3. #3
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,207
    Example:

    Centering anything requires setting a width less than 100&#37; for the container. Example:

    body {
    width: 950px;
    height: 600px;
    margin: 0 auto;
    background: #fff url(path to non-tiled image) no-repeat center scroll;
    }

    Change parameters as you need. Set "#fff" to background color you want. Set "scroll" to "fixed" if you want page contents to scroll over background image. CSS was given for an image that does not tile.

    Ron

  4. #4
    Join Date
    Aug 2010
    Posts
    53
    hey guys, thanks for the responce.

    I want to centre the entire page which is not in a div. Can you please give me step by step instructions?

    thanks

  5. #5
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,207
    Just did in my post.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles