How do I 'centre' my pages?
09-20-2006, 12:35 PM
|
How do I 'centre' my pages?
|
Posts: 8
Location: uk
|
How do I get my pages to display centrally on browsers? All of my pages are 800 pixels wide and whilst they look OK on large monitors they are all aligned to the extreme left of the screen.
I’m sure there’s a ‘simple’ solution but I’m far too thick to find it.
Any help would be much appreciated.
Thanks
Btw, I’m using Dreamweaver 8 and I don’t have a clue when it comes to CSS.
|
|
|
|
09-20-2006, 01:30 PM
|
Re: How do I 'centre' my pages?
|
Posts: 1,113
|
Well CSS is the way to do it, but
I don't do DW but admit to resorting to FrontPage every now and then.
On your local computer with the page open in DW, try right clicking and see if there is a place to set the page properties. It is there somewhere! If not on the right click it will be somewhere in the menus.
Then just select the left margin you desire.
|
|
|
|
09-20-2006, 01:43 PM
|
Re: How do I 'centre' my pages?
|
Posts: 8
Location: uk
|
Thanks for the reply colbyt.
I can set 'margins' as you suggest but I was hoping (against hope) that there would be a simple html solution.
Many of the pages I have were assembled a few years ago when most people had fairly modest monitors. I worked on the basis of trying to display each page on a small monitor in order to avoid excessive 'sideways' scrolling, hence the 800 pixels width.
I also went for 'simplicity' and never really felt the need to delve into the dark secrets of CSS. In the absence of a quick html 'fix' I suspect I have a steep learning curve ahead.
Once again thanks for the reply. By the way, you have an excellent site here.
|
|
|
|
09-20-2006, 02:47 PM
|
Re: How do I 'centre' my pages?
|
Posts: 89
Location: London, UK
|
If your provide us with the link to your website or some sample code I might be of some help.
|
|
|
|
09-20-2006, 03:03 PM
|
Re: How do I 'centre' my pages?
|
Posts: 8
Location: uk
|
Thanks for the offer JohnS
This link is to a site I put together for my own amusement a few years ago www.zaputa.com
I know it's a bit 'clunky' and inconsistent in places but I don't feel too inclined to undertake an extensive overhaul at the moment.
I know I'm going to have to address the CSS issue soon but, if I'm honest, I'm really looking for a pretty quick fix to apply to a couple of new sites I'm working on.
Thanks for taking an interest, I do appreciate it.
|
|
|
|
09-20-2006, 03:39 PM
|
Re: How do I 'centre' my pages?
|
Posts: 89
Location: London, UK
|
All you need to do is apply some <center> </center> surrounding all your table data.
So add one here:
Code:
eButtons/images/Enter_f4.gif')">
<center><table width="800" border="0" cellspacing
and one at the end:
Code:
</tr>
</table></center>
<p> </p>
</body>
But yes, as you said your pages are very clunky, non standard and have alot of surplus coding that isn't needed. But having said that, this solution will suit you for the time being.
Hope that helps, and if you need anymore help let me know.
|
|
|
|
09-20-2006, 03:58 PM
|
Re: How do I 'centre' my pages?
|
Posts: 6,699
Location: Tennessee
|
Noooo.... no deprecated <center> tag !!!
You can easily use CSS to center a layout, even one done with tables (bleeaahh). What you'll have to do is "wrap" the whole thing in a div that gets centered.
Then you would need the following in a CSS file:
body{text-align: center} --- for IE
On the wrapper div you would do this:
#wrapper{
position: relative;
width: 800px;
margin: 0 auto; - centers for standards-compliant browsers
text-align: left; - aligns text inside the wrapper to the left
}
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
|
|
|
|
09-20-2006, 03:59 PM
|
Re: How do I 'centre' my pages?
|
Posts: 89
Location: London, UK
|
Obviously that would be the more correct way, but I was just working to the needs he gave Lady.
|
|
|
|
09-20-2006, 10:05 PM
|
Re: How do I 'centre' my pages?
|
Posts: 1,113
|
Quote:
Originally Posted by DwC
Many of the pages I have were assembled a few years ago when most people had fairly modest monitors. I worked on the basis of trying to display each page on a small monitor in order to avoid excessive 'sideways' scrolling, hence the 800 pixels width.
I also went for 'simplicity' and never really felt the need to delve into the dark secrets of CSS. In the absence of a quick html 'fix' I suspect I have a steep learning curve ahead.
Once again thanks for the reply. By the way, you have an excellent site here.
|
You may want to do a little polling. The general consensus of opinion that I am aware of is that most people still surf in a 800x600 window even with the high res monitors. They usually have other things open.
Being older and not as sharp-eyed I alway work at that res. Maybe with my next monitor I will move up to 1024.
BTW, I will risk Lady's wrath by saying that the suggested solution while not a "good thing" will work. Feel the glare?
Yeah and I wish this was my site.  I am sure the mods and owner appreciate your compliment.
|
|
|
|
09-20-2006, 10:30 PM
|
Re: How do I 'centre' my pages?
|
Posts: 7
|
As stated above...
Use CSS, margin: auto; is what I always use, or text-align: center; for text.
|
|
|
|
09-21-2006, 10:48 AM
|
Re: How do I 'centre' my pages?
|
Posts: 126
Location: Australia
|
align="center" in table
If you use tableless, use margin: auto. Ladynred has given you the explanation.
__________________
▌TRIBOLIS.COM : Quality Linux Web Hosting Solutions : Since 2004
└ WHM/cPanel | PHP 5 | 24x7 Support NOW | Daily Backups!
▌WeLoveCSS.com • XHTML & CSS Forum for everyone! •
|
|
|
|
09-22-2006, 07:28 AM
|
Re: How do I 'centre' my pages?
|
Posts: 8
Location: uk
|
Many thanks to you all for some sound advice - I'm off now to 'swot-up' on CSS. I may be gone some time.
|
|
|
|
09-23-2006, 03:55 AM
|
Re: How do I 'centre' my pages?
|
Posts: 485
Name: Chip Johns
Location: Savannah Georgia
|
I prefer this method. Easy, down and dirty. getting the content in the center of your page is done through the body style. Then everything is justified to the left by means of the div#main styling. All content will go inside of the div#main
Code:
body {
text-align: center;
}
div#main {
width: 750px;
margin-left: auto;
margin-right: auto;
text-align: left;
}
Then your body will look like this:
Code:
<body>
<div id="main">
<!--all content goes in here-->
</div
</body>
|
|
|
|
09-26-2006, 10:30 AM
|
Re: How do I 'centre' my pages?
|
Posts: 7
Name: Chris
Location: McKinney, TX
|
I'm curious...
If you are using Dreamweaver why not select the entire table, I do this at the bottom.
Then you just select the alignment tab in the properties and select center, seems to work for me?
|
|
|
|
09-26-2006, 12:24 PM
|
Re: How do I 'centre' my pages?
|
Posts: 485
Name: Chip Johns
Location: Savannah Georgia
|
Quote:
Originally Posted by taygull
I'm curious...
If you are using Dreamweaver why not select the entire table, I do this at the bottom.
Then you just select the alignment tab in the properties and select center, seems to work for me?
|
Hi taygull,
The biggest reason is that we do not use tables... 
|
|
|
|
09-26-2006, 11:35 PM
|
Re: How do I 'centre' my pages?
|
Posts: 7
Name: Chris
Location: McKinney, TX
|
Quote:
Originally Posted by ChipJohns
Hi taygull,
The biggest reason is that we do not use tables... 
|
LOL...I guess I show my ignorance.....
I hope to learn more so my site is easier to manage next time. I feel pretty good with the way my turned out. I had no clue what I was doing (still don't), and in 5 days got a new site up that pretty much servers my purpose.
It will be great if I can convert it to something that makes it easier to update text and graphics.
Last edited by taygull : 09-27-2006 at 09:09 AM.
|
|
|
|
09-27-2006, 08:05 AM
|
Re: How do I 'centre' my pages?
|
Posts: 377
Name: Venkat Raj
Location: Salem, South India
|
1. <body style="text-align:center">
2. <body> <div align=center></div></body>
3. <table align=center>
__________________
All the Buddhas of all the ages have been telling you a very simple fact: Be -- don't try to become.
|
|
|
|
09-27-2006, 08:36 AM
|
Re: How do I 'centre' my pages?
|
Posts: 485
Name: Chip Johns
Location: Savannah Georgia
|
Quote:
Originally Posted by taygull
LOL...I guess I show my ingnorance.....
|
Not really. A few of us here are just evangelists for non-tables layout. Actually, I would gander a guess and say that at least 60% of the Web designers out there still have not stopped using tables for layout and made the switch to CSS.
You will get there if you want too. CSS is a great time saver. That is for sure. Plus, most of all, it is the right way to do it. 
|
|
|
|
09-27-2006, 09:08 AM
|
Re: How do I 'centre' my pages?
|
Posts: 7
Name: Chris
Location: McKinney, TX
|
I guess I also show my bad spelling! LOL
|
|
|
|
10-01-2006, 09:03 PM
|
Re: How do I 'centre' my pages?
|
Posts: 34
|
Hey, Just note, <center></center> is a depricated tag. <p style="text-align:center;">Content </p> is the new way
|
|
|
|
|
« Reply to How do I 'centre' my pages?
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|