简体   繁体   English

Internet Explorer无法正确显示页面!

[英]Internet explorer not displaying page properly!

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. 我一直在使用Flock(基于Chromium)。

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. 而现在,我的朋友告诉我,在Internet Explorer上查看我的网站时,所有内容都显示在浏览器窗口的左侧。

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. 整个网站在IE以外的所有浏览器上仍能完美显示。

1) Set 'text-align: center' to <body> 1)将'text-align:center'设置为<body>
2) Limit #main width to your page width (1000px) 2)将#main宽度限制为您的页面宽度(1000px)
3) Set 'margin: 0 auto' and 'text-align: left' to #main 3)将'margin:0 auto'和'text-align:left'设置为#main

With this, your page should be centered in all browsers. 这样,您的页面应该在所有浏览器中居中。

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. 它在Mac上的Mozilla Firefox,Safari和Chrome上运行良好。

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. 看起来可能不会导致对齐方式发生变化。

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. 我最近阅读了有关PHP的教程。 It said that when using $_REQUEST , I need to place the PHP <?php //... ?> code ABOVE everything on the PHP/HTML page, like this: 它说,当使用$_REQUEST ,我需要将PHP <?php //... ?>代码放在PHP / HTML页面上的所有内容之上,如下所示:

<?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. ...事实证明,使PHP代码位于标准HTML声明上方,会使页面的内容与页面的最左侧对齐。 Strange. 奇怪。 And it only happens in Internet Explorer (AFAIK). 它仅在Internet Explorer(AFAIK)中发生。 It doesn't seem to happen in Flock, Chrome, Safari, or Opera. 它似乎在Flock,Chrome,Safari或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. 无论如何,将PHP代码放在<head>部分(我一直认为是正确的方法)之后,现在可以在每个浏览器中正确对齐页面。

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. 感谢所有向我致敬的CSS知识,并帮助我解决了这些问题。 Your help was much appreciated. 非常感谢您的帮助。 :-) :-)

Jason 杰森

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM