SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: auto centering

  1. #1
    SitePoint Wizard
    Join Date
    Dec 2004
    Location
    At My Desk!!
    Posts
    1,642
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    auto centering

    Ok so i have a container that i want to center everything, i can make it work if i set a fixed width but that isnt good if the user has a smaller resolution.

    heres my container

    HTML Code:
    #maincontainer
    {
    
    	margin: 0 auto;
    	
    	width: 1024px;
    
    }
    how can i get it to center without having a specific width please.

    p.s my main content inside this container is at a width of 768px
    "Am I the only one doing ASP.NET in Delphi(Pascal)?"

  2. #2
    SitePoint Wizard
    Join Date
    Oct 2005
    Location
    London
    Posts
    1,678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    The text-align:center on the body and the text-align:left on the wrapper in all4's code is what makes it work.

    See this link for a full explanation:

    http://www.simplebits.com/notebook/2...centering.html


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
  •