Forums

Problem: I can't center my theme? (8 posts)

  1. fredrikweb
    Member
    Posted 3 years ago #

    Hi all out there!

    My problem is that I can't get my theme centered, I have only done the header design so far but I can't center it using either margin:0px auto or using margin-left and right.

    Here's the link
    Here's the css

    ----------------------------------------------------

    Thanks!

  2. Peter Boosten
    Member
    Posted 3 years ago #

    It seems you gave body a width of 773 px, and "rap" ("wrap"?) div nothing, not even a 'margin: 0 auto;'

    Try applying the width and margin to "rap".

  3. Mark / t31os
    Moderator
    Posted 3 years ago #

    Your wrapper element has ...

    id="rap"

    Yet the stylesheet refers to #wrapper ....

    Perhaps the problem?

  4. fredrikweb
    Member
    Posted 3 years ago #

    Thanks alot pboosten for reminding me. It was just that thing that made me find the error.

    So here's what I did.

    Solution:

    I deleted the wrap div that I had in the index.php (it was surrounding everything in it, also deleted the wrap in the CSS) and gave the body margin:0px auto.

    Finito!

  5. Mark / t31os
    Moderator
    Posted 3 years ago #

    You'd be better off keeping the wrapper, and just updating the ID...

    <div id="wrapper" etc...

    Wait until you start trying to add sidebars or floating elements, you're going to need that wrapper again...

  6. Peter Boosten
    Member
    Posted 3 years ago #

    You'd be better off keeping the wrapper, and just updating the ID...

    My idea as well...

  7. fredrikweb
    Member
    Posted 3 years ago #

    Okey, then I add the wrapper div again with only the width, that's correct? :)

    ----------------------------------------------------------------------

    And by the way. The wrapper div and the raf div has nothing to do with eachother. I made the wrapper div to center the whole theme, how I did was I simply wrote the div tag and ID wrapper above everything in the index.php and ended it at the bottom under everything. I haven't heard about the raf ID before, what does it do?

    And I don't need to update the ID because its already named wrapper in the index.php file.

    Here's a link to the index.php and you can see how I added the div wrapper.
    ---------------------------------------

    Thanks

    (BTW) I really appreciate your help, this is actually my first theme I make in wordpress (/BTW)

  8. Mark / t31os
    Moderator
    Posted 3 years ago #

    You can't put the wrapper around everything like that...

    The header get_header() creates the HTML and BODY tags, and you can't place markup before those...

    Move the wrapper into the header.php and place it just after the <body> tag...

    so..

    <body>
    <div id="wrapper">

    ...etc..

    Move the closing tag </div> into the footer before the closing body tag </body>

    Info on body and html tag.
    http://www.w3schools.com/tags/tag_html.asp
    http://www.w3schools.com/tags/tag_body.asp

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags