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.
The forum of the forums
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 Sun 1 Apr - 22:37

    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 Tue 3 Apr - 0:31; 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 Sun 1 Apr - 23:12

    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 Sun 1 Apr - 23:37

    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 Mon 2 Apr - 2:24

    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 Mon 2 Apr - 3:34

    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 Mon 2 Apr - 14:42

    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 Mon 2 Apr - 15:48

    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 Mon 2 Apr - 17:00

    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 Tue 3 Apr - 0:30

    ankillien - thanks! that solved my problem! Smile

    And thanks to your all for your good support!

    /Nova

      Current date/time is Wed 13 Nov - 18:41