PDA

View Full Version : Centre this style.css? REP+6



efq
13-06-2009, 10:08 PM
I was wondering is it possible for anyone to centre all of this.

At the moment it seems to be a bit on the left and I would prefer it in the middle.

If you can I will rep+ 6.

Thanks.


@charset "utf-8";

body {
background-image: url(images/bg.PNG);
margin: auto;
margin-left:0px;
margin-right:0px;
}

.wrapper {
width: 100%px;
}

#top {
background-image: url(images/top.gif);
width: 100%px;
height: 24px;
padding-top: 9px;
padding-left: 11px;
font-size: 10px;
font-family: Verdana;
color: #FFFFFF;
margin: 0 auto;
text-align: center;
}

#banner {
background-image: url(images/banner.PNG);
width: 902px;
height: 151px;
margin-left: 60px;
}

#left_container {
width: 209px;
float: left;
margin-left: 60px;
margin-top: 0px;
}

#box1 {
background-image: url(images/box1.PNG);
margin-top: 10px;
width: 199px;
height: 26px;
padding-left: 10px;
padding-top: 10px;
font-size: 10px;
font-family: Tahoma;
font-weight: bold;
color: #FFFFFF;
}

#box2 {
background-image: url(images/box2.PNG);
width: 193px;
padding-left: 8px;
padding-right: 8px;
font-size: 9px;
font-family: Verdana;
color: #000000;
}

#box3 {
background-image: url(images/box3.PNG);
height: 10px;
width: 209px;
}

#middle_container {
width: 456px;
float: left;
margin-left: 13px;
}

#cont1 {
background-image: url(images/cont1.PNG);
width: 436px;
padding-left: 10px;
padding-right: 10px;
padding-top: 8px;
font-family: Verdana;
font-size: 10px;
color: #000000;
}

#cont2 {
background-image: url(images/cont2.PNG);
width: 421px;
height: 83px;
padding-left: 20px;
padding-right: 15px;
padding-top: 16px;
font-family: Verdana;
font-size: 9px;
color: #777777;
text-align: center;
}

#right_container {
width: 209px;
float: left;
margin-left:15px;
margin-top: 0px;
}

#box1 {
background-image: url(images/box1.PNG);
margin-top: 10px;
width: 199px;
height: 26px;
padding-left: 10px;
padding-top: 10px;
font-size: 10px;
font-family: Tahoma;
font-weight: bold;
color: #FFFFFF;
}

#box2 {
background-image: url(images/box2.PNG);
width: 193px;
padding-left: 8px;
padding-right: 8px;
font-size: 9px;
font-family: Verdana;
color: #000000;
}

#box3 {
background-image: url(images/box3.PNG);
height: 10px;
width: 209px;
}

Baioslaio
13-06-2009, 10:13 PM
.wrapper {
width 100%px;
margin-left: auto;
margin-right: auto;
}


?

efq
13-06-2009, 10:14 PM
.wrapper {
width 100%px;
margin-left: auto;
margin-right: auto;
}


?
Nope, didn't work. I don't think anything changed. REP+ for trying though.

Iszak
13-06-2009, 10:14 PM
Why have you got
width: 100%px; you either use percentage or pixels, or another unit. And yeah, to align it center you'd add
margin: 0 auto; to the wrapper. If it doesn't work it's because you probably triggered quirks mode and that's often caused by no doctype.

efq
13-06-2009, 10:16 PM
Why have you got
width: 100%px; you either use percentage or pixels, or another unit. And yeah, to align it center you'd add
margin: 0 auto; to the wrapper. If it doesn't work it's because you probably triggered quirks mode and that's often caused by no doctype.
I added it so its now
body {
background-image: url(images/bg.PNG);
margin: auto;
margin-left:0px;
margin-right:0px;
margin: 0 auto;
} but nothing changed. Quirks mode btw?

Iszak
13-06-2009, 10:18 PM
God.. dont' just add all the code people throw at you, you only need margin: 0 auto; and it's to the .wrapper not the body. Also quirks mode can be read about here http://en.wikipedia.org/wiki/Quirks_mode

efq
13-06-2009, 10:25 PM
God.. dont' just add all the code people throw at you, you only need margin: 0 auto; and it's to the .wrapper not the body. Also quirks mode can be read about here http://en.wikipedia.org/wiki/Quirks_mode
You did say body in the post above then edited it ;)

But nope, still doesn't work and i'll just look at that page.

Mentor
13-06-2009, 10:35 PM
In addition to having its margins set auto you also need to set a width on the wrapper

for example:
margin: 0 auto;
width:900px;

Else the thing will be centered, but you wont be able to tell as its page width anyway :)

efq
13-06-2009, 11:04 PM
That sorta helped although the 3 boxes on the right of the main content is under the main content.

Edit: Nevermind, changed it from 900 to 1000 and wala.

Thanks everyone, rep+ added to everyone.

Want to hide these adverts? Register an account for free!