Old 11-16-2006   #1 (permalink)
Registered User
 
CBCOOLEST's Avatar
 
Join Date: Oct 2006
Posts: 151

Centering...

Hey guys.I've got a pretty stupid question for some of you but fo me it's a preety hard one....How can I center my website so that at any resolution it will be in the center?
PS I don't know CSS ...Maybe a useful link if you can.
Thnx a lot
CBCOOLEST is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-16-2006   #2 (permalink)
Rusty Bio-Hazard!
 
notjustgraphics's Avatar
 
Join Date: Sep 2006
Location: Toronto, Ontario, Canada
Posts: 1,163

Send a message via MSN to notjustgraphics
The easiest way without using CSS is to put your whole content inside a table and set the alignment of the table to "center".

CSS Is the much preferred method though.... If you're interested, here's a good page that explains how to use DIV's:

CSS Centering: Auto-width Margins

This is a good time to start learning CSS... it's a lot easier than you might think once you get under the surface.

Mike.
__________________
notjustgraphics is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-16-2006   #3 (permalink)
Registered User
 
CBCOOLEST's Avatar
 
Join Date: Oct 2006
Posts: 151

Ok I read the article but I've got some questions:
1.Must I have an additional fle to the html so that this thing works?
2.Where do I put those lines,between the <head></head>?
3.Will this code apply for all content of the site or how will it work the site with this code?
Any other tutorial for centering a website?
CBCOOLEST is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-16-2006   #4 (permalink)
Rusty Bio-Hazard!
 
notjustgraphics's Avatar
 
Join Date: Sep 2006
Location: Toronto, Ontario, Canada
Posts: 1,163

Send a message via MSN to notjustgraphics
No, you don't have to store your CSS in seperate files, it's just more convenient...

Based on the documentation at the link i posted, you would put

Quote:
<style type="text/css">
<!--
body {
margin:50px 0px; padding:0px;
text-align:center;
}

#Content {
width:500px;
margin:0px auto;
text-align:left;
padding:15px;
border:1px dashed #333;
background-color:#eee;
}
-->
</style>
This must be somewhere inside your <head></head>

Then, you would add the #Content to your tags like this:

Quote:
<div class="Content"> whatever goes here </div>
or

Quote:
<table class="Content">
<tr>
<td> whatever goes here </td>
</tr>
</table>
Now, whatever tags you put in your css under #Content will be applied to the objects you apply that class to. (tags that don't apply to the object type are ignored)

There is so much you can do with CSS.

If you store your CSS in a seperate file (ie: mystyles.css) you can just link the file to your HTML by adding:

Quote:
<link href="path/to/file/mystyles.css" rel="stylesheet" type="text/css" />
somewhere in your <head></head> tag.

You can even load multiple CSS styles if you need to. Just remeber that if you define the same class (ie: #Content) in more than one file, the last one you load will be used.

Hope this helps.

Mike.
__________________
notjustgraphics is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-16-2006   #5 (permalink)
Registered User
 
CBCOOLEST's Avatar
 
Join Date: Oct 2006
Posts: 151

Ok thnx a lot ...These explanations brought a lot of light in my "head".I'll try to do something like this and see what happens.But that will be in the weekend.Thnx for the tips Mike.
CBCOOLEST is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 11-16-2006   #6 (permalink)
Rusty Bio-Hazard!
 
notjustgraphics's Avatar
 
Join Date: Sep 2006
Location: Toronto, Ontario, Canada
Posts: 1,163

Send a message via MSN to notjustgraphics
always glad to help if I can...

Mike.
__________________
notjustgraphics is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 12-07-2006   #7 (permalink)
Registered User
 
Join Date: Dec 2006
Posts: 2

Mike essentially hit it on the head, and he is right, as I learned more about CSS, its actually quite a beautiful/powerful thing. I personally think its a very clean way to handle code. But I was struggling with this same problem too, (without knowledge of CSS) and I used the following quick and dirty solution :

<Body>
<table width="100%" height="100%" align="center" cellspacing="0" cellpadding="0" border="0">
<tr>
<td align="center" valign="middle">

///CONTENT OF WEBPAGE, put all your code here///

</td>
</tr>
</table>
</body>

Just another method which you can use. Hope between both of these solutions you can center your page. Oh yea, and you also might want to have a nice background image so people can at least see something good on either side of the centered page!
Sulman is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
image ready... centering scottiedo Adobe Photoshop 5 10-28-2006 10:34 PM
Centering In Photoshop stiney51 Adobe Photoshop 2 06-02-2006 08:25 PM
Need help centering website bgrablin HTML / PHP / ASP / JS 10 11-08-2005 05:22 PM
Centering In Window GoldNetX HTML / PHP / ASP / JS 2 07-12-2004 03:29 AM


All times are GMT +1. The time now is 05:15 PM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2008 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT