• 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!

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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”.

    Your wrapper element has …

    id="rap"

    Yet the stylesheet refers to #wrapper ….

    Perhaps the problem?

    Thread Starter fredrikweb

    (@fredrikweb)

    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!

    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…

    You’d be better off keeping the wrapper, and just updating the ID…

    My idea as well…

    Thread Starter fredrikweb

    (@fredrikweb)

    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)

    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.
    https://www.w3schools.com/tags/tag_html.asp
    https://www.w3schools.com/tags/tag_body.asp

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Problem: I can’t center my theme?’ is closed to new replies.