centering my website

For requests for help from CG administrators, Wranglers, and experienced CG members. Please read the FAQ before posting. Also look at CG Wiki for tutorials and how-tos written by other CG webtoonists.
Post Reply
User avatar
Gothboi
Newbie
Posts: 20
Joined: Wed Nov 30, 2005 12:55 pm

centering my website

Post by Gothboi »

hi

i'm trying to centre my website, it's only 800px wide...so it fits on any monitor settin but the thing is on monitors with a higher res (like mine...i run my machine on 1280 x 1024) the site is all on the left side and the rest of the screen is just filled with a bg image (in my case solid black)

...what i'm trying 2 ask...how do i create margins so that my 'site' is always in the middle of the screen

some poeple told my i should add this code:

body {
width : 800px;
margin-left : auto;
margin-right : auto;
}

...but that piece of code changes nothing at all

please help

User avatar
Black Sparrow
Cartoon Anti-Hero
Posts: 6973
Joined: Fri Jul 22, 2005 9:04 am
Location: Violating your restraining order
Contact:

Post by Black Sparrow »

Try this:

After the <body> tag, type <center>

Then, right before the </body> tag, type </center>
This is going in my notebook titled "Things I Didn't Know about Surface Dwellers."
ImageImageImageImageImage
ImageImage

User avatar
Churusaa
Regular Poster
Posts: 228
Joined: Sat Mar 04, 2006 2:50 am
Contact:

Post by Churusaa »

Where are you adding that code? It should probably go in your <body> tag, as such:

Code: Select all

<body {
width : 800px;
margin-left : auto;
margin-right : auto;
} >YOURPAGE</body>
---Churusaa
I smite thee with my mighty smiting rod of smitey-ness.
Image
Life is like pie... yeah... pie.

User avatar
Rkolter
Destroyer of Words (Moderator)
Destroyer of Words (Moderator)
Posts: 16399
Joined: Tue Jun 24, 2003 4:34 am
Location: It's equally probable that I'm everywhere.
Contact:

Post by Rkolter »

That'd actually end up centering EVERYTHING. Text, title images, image bars, the comic, tables, etcetera. At least, I'm pretty sure that is what it would do.

If you like the layout of your page, but just want your page itself (in that layout) centered, you can put your whole page within a table, then center the table. Someone will probably hit me with a stick for doing that because I'm sure it's not up to standard for code, but it would work.

Code: Select all

--- header, line for body, div, etcetera ---
<center>
<table width=800 border=0>
<td width=100% border=0>

--- entire comic and website portion ---

</td>
</table>
</center>
Image Image ImageImage
Crossfire: "Thank you! That explains it very nicely, and in a language that someone other than a physicist can understand..."

Denial is not falsification. You can't avoid a fact just because you don't like it.
"Data" is not the plural of "anecdote"

User avatar
Gothboi
Newbie
Posts: 20
Joined: Wed Nov 30, 2005 12:55 pm

Post by Gothboi »

thanx...it's all fixed now. i just added <centre> </centre> to the body...damn that was easy

User avatar
Churusaa
Regular Poster
Posts: 228
Joined: Sat Mar 04, 2006 2:50 am
Contact:

Um....

Post by Churusaa »

I guess now would be a bad time to tell you it's not centering in Firefox 1.07, wouldn't it?
---Churusaa
I smite thee with my mighty smiting rod of smitey-ness.
Image
Life is like pie... yeah... pie.

Post Reply