Results 1 to 6 of 6

Thread: Center content, vertically and horizontally?

  1. #1
    Join Date
    Jan 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Center content, vertically and horizontally?

    I'm looking for some script or some way of centering my content in the browser window both horizontally and vertically. I found one script which works, but the pages jump from the corner to the center each time they're loaded which is jarring to look at. Any thoughts? Thanks!

  2. #2
    Join Date
    Jan 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I usually fix this by using the <center> tag and having the rest of my website in a 'div wrapper'. like this:

    <body>
    <center>
    <div style="text-align: left;">


    the code for my site goes here

    </div>
    </center>
    </body>


    hopefully this help you

  3. #3
    Join Date
    Jan 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    the div SHOULD be given the same width as your page for best results

  4. #4
    Join Date
    Jan 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks! But do you know how to center vertically as well?

  5. #5
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,317
    Thanks
    30
    Thanked 136 Times in 131 Posts
    Blog Entries
    29

  6. #6
    Join Date
    Jan 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Success! That did the trick. You have no idea how long it's taken me to find a solution to what seems like such a basic thing. Thanks!

Bookmarks

Posting Permissions

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