views:

48

answers:

3

Hi All,

Okay. I bought a website template a few weeks back. It worked perfectly on all browsers.

I use Flock (based on Chromium) all the time.

And just now, my friend informed me that when viewing my site on Internet Explorer, everything is displayed to the left of the browser window.

He also viewed my site yesterday. And yesterday it worked perfectly for him, with the same browser. But the thing is, I haven't change any styles, or anything else on this particular page.

And what's more weird is that it only affects one page (the home page).

I would greatly appreciate it if any one could find the time to check it out and post back saying if it displays correctly or not, and to lead me off in the right direction so I can fix it?

Thank you

Edit:

I have tried the following:

I've gone over the stylesheet code to make sure I didn't screw it up somewhere. I've since restored the original stylesheet file (and has not helped.)

The whole site still displays perfectly on every browser OTHER THAN IE.

+1  A: 

He also viewed my site yesterday. And yesterday it worked perfectly for him, with the same browser. But the thing is, I haven't change any styles, or anything else on this particular page.

That seems strange! It works fine on Mozilla Firefox, Safari and Chrome on the Mac.

I assume that this code (in the body) is not part of the template?

<style> 
    div#commentForm
    {
        margin: 0px 20px 0px 20px;
        display: none;
    }
</style>

Doesn't look like it could cause the alignment to change though.

aaronmase
Yeah. Strange indeed! Thanks for your help!
lucifer
That is correct :)
lucifer
It shouldn't cause alignment change... But with IE, I guess you never really know :P
lucifer
There is no value "0px" but only 0
Māris Kiseļovs
@Māris Kiseļovs: Thanks! I didn't know that.
lucifer
+2  A: 

1) Set 'text-align: center' to <body>
2) Limit #main width to your page width (1000px)
3) Set 'margin: 0 auto' and 'text-align: left' to #main

With this, your page should be centered in all browsers.

Māris Kiseļovs
It does center the page on IE now BUT It also centers text on the right hand side column, which makes it look very bad.
lucifer
need to add "text-align:left;" on that column
aaronmase
A: 

Okay, I've still been having the same problem. So, after experimenting a little, here's what I figured out:

I recently read a tutorial on PHP. It said that when using $_REQUEST, I need to place the PHP <?php //... ?> code ABOVE everything on the PHP/HTML page, like this:

<?php // php code here .. ?> <html> ... page content here </html>

... As it turns out, having the PHP code above the standard HTML Declaration causes the page's content to align to the far-left of the page. Strange. And it only happens in Internet Explorer (AFAIK). It doesn't seem to happen in Flock, Chrome, Safari, or Opera.

Anyway, after placing the PHP code inside the <head> section, which I always thought was the right way, the page is now properly aligned, in every browser.

Thanks to all of you who tought me a few things about CSS that I didn't already know, and for helping me sort this out. Your help was much appreciated. :-)

Jason

lucifer