# How to center a website



## psonio (Oct 19, 2006)

Hello good people,

I wish i had come across these forums way before i started my site.
I have a site going at psonio.gr with spreadshirt.

I am using Dreamweaver 8 and i am trying to figure out how to make the whole site center, no matter the user's resolution.
Can someone help? 

Thanks in advance.


----------



## zhenjie (Aug 27, 2006)

looks like you centred it already?


----------



## punkapalooza (Oct 18, 2006)

psonio said:


> Hello good people,
> 
> I wish i had come across these forums way before i started my site.
> I have a site going at psonio.gr with spreadshirt.
> ...


looks pretty bang on centered to me. i have a question, how much do u need to know to do that in dreamweaver? i have no html knowledge watsoever.


----------



## DirtyJerseys (Oct 6, 2006)

It looks centered when you open the page first, but I think what psonio wants is that if one was to grab the browser's edge and adjust the size, the site design would stay centered in the browser. This is not the case. I am not sure how to do this. I use Net Object Fusion for web design. Is there anyone with the talent with Dreamweaver out there that can help with this?


----------



## psonio (Oct 19, 2006)

psonio said:


> Hello good people,
> 
> I wish i had come across these forums way before i started my site.
> I have a site going at psonio.gr with spreadshirt.
> ...


Yes, it appears centered, because I have used a table cell object on the left. But if you resize or use a different resolution, it will not be centered. I need something that will center relative to the browser window. I am assuming it might have to do with the page properties.

As for the skills needed to do this in Dreamweaver, it's not that hard, but it takes some getting used to the software. I tried to use GoLive as well, and found it much more difficult. Frontpage just sucks.


----------



## VariantArt (Sep 17, 2006)

Perhaps you can try using CSS and utilize a wrapper Div tag to contain your content.


#Wrapper{
margin-right: auto;
margin-left: auto;
padding-right: 0px;
padding-left: 0px;
text-align: left;
position: relative;
width: 800px;
}

- Your content goes here -

If you're using tables, you might have to incorporate this into your code properly. Just a thought...


----------



## DirtyJerseys (Oct 6, 2006)

Did a quick search on web... see if these steps will work:

_To ALign a Table in the Center Try ths Following_

_

_

_Adding Align=center will alin your Table in Center._
_And to entire the Whole Page OR bunch of Tables Surround them with the DIV tag like this_
_

...._



_

_


_.._
_Third way is to Align it at Certain point like this_
_

_


_By adding Style Attribute it will ALign Table to 100px Top and 100px Left_


----------



## jdr8271 (Jun 16, 2005)

margin: auto; is center in css. or in html you can put the ​ tag around your content.


----------



## gammonstein (Jun 30, 2006)

another option to try. Look at a site that successfully has the thing centered, then copy the source code, paste it into the dreamweaver document, then delete what you don't want.


----------



## psonio (Oct 19, 2006)

Ok, i tried the following, none of which worked:

#Wrapper in CSS
in HTML
​ in HTML
Maybe my webdesign skills are rather dreadful, so i didn't get it to work. I looked into the source code of some web2.0 sites to try to see how they are centered, but no dice.

Anybody?Help?


----------



## jdr8271 (Jun 16, 2005)

psonio said:


> Ok, i tried the following, none of which worked:
> 
> #Wrapper in CSS
> _<div align="center"> _in HTML
> ...




```
<style="text/css">
.centerdiv            { margin:auto; }
</style>

<div class="centerdiv">
content here
</div>
```


----------



## TiddliBoom.com (Aug 17, 2006)

psonio said:


> Hello good people,
> 
> I wish i had come across these forums way before i started my site.
> I have a site going at psonio.gr with spreadshirt.
> ...


 In most browsers, the site is probably already centered and working just fine. I haven't studied previous suggestions in detail, but from the ones I have looked at, they seem to suggest general ways of centering content, but unfortunatelly not considering the particulars in your explicit code. (if I missed someone who actually did that, I'm sorry).

The site was not made in Dreamweaver from the start, but in Microsoft Frontpage or some other MS application. This program has created some oddities that some browsers might react on.

The first thing is that you should have a correct Doctype definition. At the very top of the documents, delete this:

```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0024)http://www.fushirts.net/ -->
```
and replace with this:


```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
```
Next is to move the width attribute to a place where it can make things happen. Right now, it's in the nested table's cell, which might make some browsers render the centering wrong. Delete the first 4-5 lines after the opening body tag:


> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
> 
> <TR>
> <TD vAlign=top width=800>
> <TABLE width=752 border=0 align="center" cellPadding=0 cellSpacing=0 borderColor=#bcbcbc><!-- header -->


and paste this there instead:

```
<TABLE width="760" border=0 align="center" cellPadding=0 cellSpacing=0>
  
  <TR>
    <TD vAlign=top>
      <TABLE border=0 align="center" cellPadding=0 cellSpacing=0 borderColor=#bcbcbc><!-- header -->
```
(you had a width of 800 pixels before, but I think you ought to have less to allow space for scroll bars, etc. I put 770, but you might change to 760 ot even 750 if you like).

Lastly, the program didn't put parenthesis around the attributes (padding, width, cellspacing, etc). Most browsers accept them anyway, but it's a good thing to always do that. So, the above should be:

```
<TABLE width="760" border="0" align="center" cellPadding="0" cellSpacing="0">
  
  <TR>
    <TD vAlign="top">
      <TABLE border="0" align="center" cellPadding="0" cellSpacing="0" borderColor="#bcbcbc"><!-- header -->
```
I hope this will help. Good luck.

Cheers,
Dan


----------



## TexasTShirts (Oct 23, 2006)

Hey guys,

I'm not sure if this applies to any of your questions, but when I export a website with cells via Photoshop, all I do to center the images within the cells on the page is:

1. Press (Control + A) - Windows / (Apple + A) - Mac in Dreamweaver

2. Go into the Properties menu and hit the 'Center Align' button.

That works for me whenever I need objects within cells centered. If that doesn't work, try selecting individual cells and repeating step two. Hope this helps/pertains to anyone 

Sincerely,
Abdul R. Mitha
Texas T-Shirts CEO​


----------



## psonio (Oct 19, 2006)

TiddliBoom.com said:


> ... considering the particulars in your explicit code...


Thank you Dan!

I actually tried to reply earlier, thanking you, but I think I screwed up and it wasn't posted. I looked at your site as well, and noticed that you offer web design. I might have some work for you when i decide to make my sites more complex.


----------



## TiddliBoom.com (Aug 17, 2006)

psonio said:


> Thank you Dan!
> 
> I actually tried to reply earlier, thanking you, but I think I screwed up and it wasn't posted. I looked at your site as well, and noticed that you offer web design. I might have some work for you when i decide to make my sites more complex.


No probs.
If you eventually need help, please do as Rod suggests; send me a PM and we'll take it from there.

Cheers,
Dan


----------

