css problems with center code Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.
5 posters

    css problems with center code

    Novaen
    Novaen
    Forumember


    Female Posts : 29
    Reputation : 0
    Language : Danish, English
    Location : Denmark

    Solved css problems with center code

    Post by Novaen April 1st 2012, 9:37 pm

    Hi.

    I've changed the navbar with a picture, and I've tried to center it with some center codes for css. But it doesn't work!

    This is my code for the navbar pic:

    #pun-head #pun-navlinks {
    background-image:url('https://2img.net/h/oi44.tinypic.com/lguap.png'); }
    #pun-head #pun-navlinks {
    background-image:url('https://2img.net/h/oi44.tinypic.com/lguap.png');
    background-repeat: no-repeat; }

    #pun-head #pun-navlinks {
    padding: 4.1em 1.5em 5.5em 1.1em;
    background-color: transparent
    border-color: #ffffff;
    }

    I don't know where to put the center codes, and if it does matter, but I've tried:

    margin: 0 auto

    and:

    margin-left:auto;
    margin-right:auto;

    and then:

    text-align: center

    but none of them seems to work on my PunBB forum.

    What to do??


    Last edited by Novaen on April 2nd 2012, 11:31 pm; edited 3 times in total
    LGforum
    LGforum
    Hyperactive


    Male Posts : 2265
    Reputation : 264
    Language : English
    Location : UK

    Solved Re: css problems with center code

    Post by LGforum April 1st 2012, 10:12 pm

    What is you need centered? Everything seems centered on your forum.

    The codes go inside the selector that you want centered of course.
    Novaen
    Novaen
    Forumember


    Female Posts : 29
    Reputation : 0
    Language : Danish, English
    Location : Denmark

    Solved Re: css problems with center code

    Post by Novaen April 1st 2012, 10:37 pm

    css problems with center code Unavngivet-8

    it's the picture I want to center. This screen shot is taken when I've zoomed out in the browser, but the pic should center too.
    Light Elf
    Light Elf
    Forumember


    Posts : 144
    Reputation : 11
    Language : English

    Solved Re: css problems with center code

    Post by Light Elf April 2nd 2012, 1:24 am

    You can try it manual by adding this code:
    Code:
    margin-left:Ypx; /*Y is a number*/
    LGforum
    LGforum
    Hyperactive


    Male Posts : 2265
    Reputation : 264
    Language : English
    Location : UK

    Solved Re: css problems with center code

    Post by LGforum April 2nd 2012, 2:34 am

    That image was centered when I visited your forum.
    Make sure you set a width in percentage.

    Code:

    width: 98%;
    margin: 1px auto;

    Make sure that goes in the same selector.
    Novaen
    Novaen
    Forumember


    Female Posts : 29
    Reputation : 0
    Language : Danish, English
    Location : Denmark

    Solved Re: css problems with center code

    Post by Novaen April 2nd 2012, 1:42 pm

    doesn't seems to work.

    LGforum - well, I only see it when I zoom out on my board. If I've it in the normal stage it's just looking fine. I saw the little problem when I visited a friend, and her computer is bigger than mine, so it wasn't centred there.
    E-Mark
    E-Mark
    Active Poster


    Male Posts : 1411
    Reputation : 169
    Language : English
    Location : Bitcoin

    Solved Re: css problems with center code

    Post by E-Mark April 2nd 2012, 2:48 pm

    Add this to your CSS Stylesheet:

    Code:

    #pun-navlinks ul {
       text-align: center;
       }

    Wink
    ankillien
    ankillien
    Energetic


    Posts : 5198
    Reputation : 129
    Language : English, XHTML, CSS, JS, PHP, SQL

    Solved Re: css problems with center code

    Post by ankillien April 2nd 2012, 4:00 pm

    Hi,

    I think its the background image that needs to be centered, you can use this CSS code...

    Code:
    #pun-head #pun-navlinks {
    background-position: center;
    }
    Novaen
    Novaen
    Forumember


    Female Posts : 29
    Reputation : 0
    Language : Danish, English
    Location : Denmark

    Solved Re: css problems with center code

    Post by Novaen April 2nd 2012, 11:30 pm

    ankillien - thanks! that solved my problem! Smile

    And thanks to your all for your good support!

    /Nova