Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Apr 2006
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    center page in browser window

    I want to center my site based on the browser width. I put in a container div, but it is still not working. Any suggestions? Do I need to change all my other divs to relative?

    #container {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    }

  • #2
    Regular Coder kewlceo's Avatar
    Join Date
    Mar 2006
    Location
    California, US
    Posts
    484
    Thanks
    1
    Thanked 3 Times in 3 Posts
    You have no width (percentage of viewport, for example) defined.
    UBERHOST.NET
    Shared, reseller, semidedicated hosting and dedicated server plans.
    DirectAdmin Installatron Money-Back Guarantee 24/7 Support
    Providing "Service Above All Else" since 2005.

  • #3
    New Coder
    Join Date
    Apr 2006
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts
    How about this? (Am I closer?)

    #center{
    position:relative;
    text-align:center;
    width:100%;
    margin:0px;
    padding:0px;
    border:1px solid green;
    }

    #container {
    position:relative;
    width:800px;
    height:550px;
    margin:0;
    text-align:center;
    border:1px solid red;
    }

  • #4
    Regular Coder kewlceo's Avatar
    Join Date
    Mar 2006
    Location
    California, US
    Posts
    484
    Thanks
    1
    Thanked 3 Times in 3 Posts
    This is all it would take to make your main container:

    Code:
    #container {
    	width: 800px;
    	height: 550px;
    	margin: auto;
    	border: 1px solid red;
            text-align: center;
    }
    UBERHOST.NET
    Shared, reseller, semidedicated hosting and dedicated server plans.
    DirectAdmin Installatron Money-Back Guarantee 24/7 Support
    Providing "Service Above All Else" since 2005.

  • #5
    New Coder
    Join Date
    Apr 2006
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #6
    Regular Coder kewlceo's Avatar
    Join Date
    Mar 2006
    Location
    California, US
    Posts
    484
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Quote Originally Posted by lauerm
    Beautiful job, Michelle, well done!
    UBERHOST.NET
    Shared, reseller, semidedicated hosting and dedicated server plans.
    DirectAdmin Installatron Money-Back Guarantee 24/7 Support
    Providing "Service Above All Else" since 2005.


  •  

    Posting Permissions

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