• So I’d like to center my website so that it always takes up exactly the same space. The theme owner offered up the code and the notes below.

    1) I changed the width from 100% to 940px. Is this a reasonable size for what I am trying to do?

    2) instructions said to use margin-left: auto and margin-right: auto in order to center wrappers. I read that I should try margin: O auto (sorry can’t recall) or something to that effect.

    I wasn’t sure whether to replace the text align code with the margin code or to add the margin code to what presently exists, or use some other “margin-auto” code.

    3) how do I do all that is needed by only editing my child theme?

    Code is below:

    #wrapper1 {
    position: relative;
    text-align: left;
    width: 940px;
    }
    #wrapper2 {
    float: left;
    position: relative;
    text-align: left;
    width: 940px;
    background-image: url(“images/l_col_bg.gif”);
    background-repeat: repeat-y;
    background-position: top left;
    }

    Theme owner comments:
    Change the width values to the desired pixel width you’re looking for. You’ll also need to center the wrappers rather than float them left. There are several ways to float center but I’ve found that adding margin-left: auto; and margin-right: auto; works well in most cases.

    Sorry, these directions were not entirely clear to this newbie.

    Finally, it would be nice to be able to place a solid line around the perimeter of the contents on each page, further displaying that this is centered. Not sure that I HAVE to have this, but I would like to know how to do it.

    As always, any help would be greatly appreciated!

Viewing 1 replies (of 1 total)
  • Can you post a link to your site ? It’s really not possible to help with things like this without seeing the site and the CSS code live.

Viewing 1 replies (of 1 total)
  • The topic ‘How to center website contents’ is closed to new replies.