$20 - CSS centering job -

Discussion in 'CSS' started by Nima, Apr 14, 2008.

  1. #1
    I already have a website but need it to be centered. It uses CSS and DIVs, but I dont know how to center it.

    The URL is:

    hookahloungestore.net


    Let me know how to center it and I will send you $20.

    Thanks
     
    Nima, Apr 14, 2008 IP
  2. MakeThatDollar

    MakeThatDollar Notable Member

    Messages:
    4,451
    Likes Received:
    158
    Best Answers:
    0
    Trophy Points:
    225
    #2
    EDIT: Sorry can't get it to work for some reason.
     
    MakeThatDollar, Apr 14, 2008 IP
  3. webdesigner

    webdesigner Well-Known Member

    Messages:
    489
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Simple put all your content (header, body, footer) into 1 div with an ID of 'container'.

    And then add this to your stylesheet

    You may need to adjust width slightly.
     
    webdesigner, Apr 15, 2008 IP
  4. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Start by using a complete and proper DOCTYPE on your pages (directly above the opening <HTML> tag), and make sure that nothing is above it - not even white space. Given that you don't have a DOCTYPE at all, I'd go with HTML 4.01 Transitional here.

    
    !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    
    Code (markup):
    Then apply a margin of 0 auto and a width to your BODY selector in your stylesheet.

    Here's an example:

    
    body {
        margin: 0 auto;
        width: 990px;
    }
    
    Code (markup):
    Though honestly, I'd re-write that site template from scratch to get the most out of clean, minimal, semantic and valid markup possible that can also survive various site designs. If you don't know how or want to do this yourself, consult a professional Web developer who knows what he or she is doing for a consultation and/or a quote.
     
    Dan Schulz, Apr 15, 2008 IP
  5. Nima

    Nima Well-Known Member

    Messages:
    3,489
    Likes Received:
    243
    Best Answers:
    0
    Trophy Points:
    175
    #5
    the site software is bought, and it is a good amount of work to fix those things that you said,


    but if i find someone to do it , I will definitely hire them to do so...

    Nima
     
    Nima, Apr 15, 2008 IP
  6. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Nima, what software are you using for the site? It shouldn't be that hard to change a single template file to include the DOCTYPE, and then edit the stylesheet. (As far as a quick fix goes anyway - which is what my earlier post was mainly about; the deep cleaning can come later.)
     
    Dan Schulz, Apr 15, 2008 IP
  7. LukeKendig

    LukeKendig Well-Known Member

    Messages:
    671
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    123
    #7
    If you need someone still pm me and ill give it a go..
     
    LukeKendig, Apr 15, 2008 IP
  8. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Or she can save her money and just reply here - I'm notorious for helping people for free.
     
    Dan Schulz, Apr 15, 2008 IP
  9. od3n

    od3n Active Member

    Messages:
    715
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    60
    #9
    is it shisha site? i like that.
     
    od3n, Apr 15, 2008 IP
  10. arwen54

    arwen54 Active Member

    Messages:
    632
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    60
    #10
    nice to see another helpful person here who goes above and beyond...
     
    arwen54, Apr 15, 2008 IP
  11. Nima

    Nima Well-Known Member

    Messages:
    3,489
    Likes Received:
    243
    Best Answers:
    0
    Trophy Points:
    175
    #11
    i tried adding a DOCTYPE, but it messed everything else on the website...
     
    Nima, Apr 16, 2008 IP
  12. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #12
    It "messed everything up" because you're currently depending on the browsers to guess what you want them to do instead of explicitly telling them what they should do in the first place. In other words, the browsers are relying on their error handling techniques instead of doing the right thing the first time around.

    If you don't want to correct what the browsers are doing, wrap everything inside the BODY tags in a DIV, then apply the width and text-align: center; to the BODY, and text-align: left; to the DIV. You'll still be relying on the browser quirks, but it will act as a "band-aid" until the site can be re-coded properly.
     
    Dan Schulz, Apr 16, 2008 IP