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.

css problems with center code

5 posters

Go down

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
Novaen
Novaen
Forumember

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

http://avonue.danskforum.net/forum

Back to top Go down

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.
LGforum
LGforum
Hyperactive

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

Back to top Go down

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.
Novaen
Novaen
Forumember

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

http://avonue.danskforum.net/forum

Back to top Go down

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*/
Light Elf
Light Elf
Forumember

Posts : 144
Reputation : 11
Language : English

Back to top Go down

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.
LGforum
LGforum
Hyperactive

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

Back to top Go down

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.
Novaen
Novaen
Forumember

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

http://avonue.danskforum.net/forum

Back to top Go down

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
E-Mark
E-Mark
Active Poster

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

http://coding-spot.darkbb.com/

Back to top Go down

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;
}
ankillien
ankillien
Energetic

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

Back to top Go down

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
Novaen
Novaen
Forumember

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

http://avonue.danskforum.net/forum

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum