Results 1 to 6 of 6
  1. #1

    How to center properly.

    Hello.

    I've put up the basic site design on www.mudhar.ca

    I'm trying to center the site. Center everything so when you look at in on different resolution screens, the basic site is always in the center. the link part in the top left corner doesnt matter. I've tried a few codes to center it but none have worked so far.. on some screens it's more to the left and on some it's more to the right. Help would be appreciated..

    thanks in advance.

  2. #2
    Administrator Dave's Avatar
    Join Date
    Sep 2004
    Location
    Te Awamutu, New Zealand
    Posts
    3,959
    Blog Entries
    79
    Try putting all your content in a container div that has a style like this:

    margin: 0 auto 0 auto;

    The top and bottom numbers can be whatever you like (I've made them 0) but the left and right numbers are set to auto, centering the div.
    Dave Owen
    MediaCollege.com

  3. #3
    thanks dave.. so how would it look? kinda confused.. i've posted the top part and bottom part of the code.. is it done like this?

    <html>
    <head>
    <meta name="author" content="">
    <meta name="txt here">
    <meta name="keywords" content="blah">[/COLOR]
    <title>Something here</title>

    <div> margin: 0 auto 0 auto;</div>

    and how would it end?


    </body>
    </html>

  4. #4
    Administrator Dave's Avatar
    Join Date
    Sep 2004
    Location
    Te Awamutu, New Zealand
    Posts
    3,959
    Blog Entries
    79
    Code:
    <div style="margin: 0 auto 0 auto;">
    Centered content here
    </div>
    Dave Owen
    MediaCollege.com

  5. #5
    Hey,

    Thanks for the reply... I tried that exact line of code, and it still doesn't center it..

    any ideas?

  6. #6
    Administrator Dave's Avatar
    Join Date
    Sep 2004
    Location
    Te Awamutu, New Zealand
    Posts
    3,959
    Blog Entries
    79
    I had another look at the page and there seems to be a few problems with it. You've got at least a couple of </div> tags that don't validate, an unclised <form> tag and possibly other problems as well. All these things will muck up the layout.

    In short, I think you need to go back to basics and start constructing the page one bit at a time, making sure everything works. Start by getting the overall page layout sorted, then add things like the search forms. I know this isn't the help you're looking for but I don't have a quick fix.

    This is a good example of why it's important to understand HTML and CSS - if you don't, these things will keep happening.
    Dave Owen
    MediaCollege.com

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
  •  
Subscribe to us on YouTube