Site Author : Topic: How to centre a page  (Read 2237 times)
April 20, 2010, 02:08:04 AM
Registered Users
Quite a regular
*
User No : 13476
Posts: 123
  • Email
Email
I want to centre the page on my blog, but I cannot do it. I've tried everything I know but it will not become bloody centred!

There are just two basic elements I want centred, the main and sidebar elements. (There are several other elements in the sidebar, but this should not prevent this, should it?

Please help!

The all-important link to said blog; http://tepidair.blogspot.com/
Logged
April 20, 2010, 12:26:10 PM
Just can't stay away
User No : 29999
Posts: 156
For that i think the problems in your CSS code.! Try searching for a CSS code for centering..
Logged

NO COMMERCIAL LINKS!
April 20, 2010, 09:33:14 PM
Just popping in
User No : 29490
Posts: 11
  • WWW
i'm agree with someone above , there is something wrong with your CSS code.

Logged

April 21, 2010, 12:27:19 AM
Registered Users
Quite a regular
*
User No : 13476
Posts: 123
  • Email
Email
My template is set out as follows;
The 'container' div (750 px wide).
1) inside this:
    a) the 'main' div (500 px wide, float: right),
    b) the 'sidebar' div (200 px wide, position: fixed, float: left).
2) inside the 'sidebar' are the 'title' div, the 'navigation' div, and 'description' div,  the 'image' div, and the 'footer' div. The divs inside the sidebar do not have 'width' values.

I believe this CSS centres the page when applied to the containing 'container div': { width: 750px; margin:0 auto; }. If this is incorrect, I hope someone here will point me at the correct method.
« Last Edit: April 21, 2010, 12:28:51 AM by William Leamy » Logged
April 21, 2010, 06:10:02 AM
Registered Users
Quite a regular
*
User No : 13476
Posts: 123
  • Email
Email
Hello Thur, it's good to have a response from you again.

As you've seen, although the CSS appears to be correct, the page is not centred. Can you see anything which might be causing this? Is it the space to the left of the sidebar? I've tried reducing this space, but this disrupts the sidebar text-formatting in Windows Firefox
« Last Edit: April 21, 2010, 06:12:43 AM by William Leamy » Logged
April 21, 2010, 06:05:39 PM
Registered Users
Quite a regular
*
User No : 13476
Posts: 123
  • Email
Email
Thur, you've been of great help here. And, at last, I'm satisfied with the centring.

I've also had a look on Firefox in Windows XP and it looks good. I assume the same holds true for Windows 7.

Thank you very much.
Logged
April 22, 2010, 07:28:26 AM
Registered Users
Quite a regular
*
User No : 13476
Posts: 123
  • Email
Email
Thur,

Dank u, en u bent altijd welkom bij lauwe lucht.

I hope I've got that right!
Logged
April 28, 2010, 11:39:21 PM
Just popping in
User No : 30704
Posts: 5
  • WWW
A much better way to do what you want is to simply insert <center> right after <body> and before <table>

Example:

</head>
<body bgcolor="#FFFFFF" leftmargin="20">
<center>
<table id="Table_01" width="766" height="755" border="0" cellpadding="0" cellspacing="0">

At the end of the table close it out with <center> again

Example:

</table>
<center>
&nbsp;</center>

This will do what you want without any special magical coding.

« Last Edit: April 29, 2010, 07:39:53 AM by Thur » Logged

No commercial links, please!
May 16, 2010, 07:11:45 PM
Just popping in
User No : 30565
Posts: 21
I want to centre the page on my blog, but I cannot do it. I've tried everything I know but it will not become bloody centred!

There are just two basic elements I want centred, the main and sidebar elements. (There are several other elements in the sidebar, but this should not prevent this, should it?

Please help!

The all-important link to said blog; http://tepidair.blogspot.com/

hi,in HTML body tag use align="center" property which will center ur page
Logged

June 03, 2010, 01:15:23 AM
New Here
User No : 31172
Posts: 1
  • WWW
With css: you need a box with
margin: 0 auto;
This will work in all browsers from after internet explorer 5!
Logged