简体   繁体   English

IE中的网站中心对齐

[英]Website centre alignment in IE

http://atomtk.co.uk/ http://atomtk.co.uk/

I am doing some browser testing from a friend on the following website. 我正在以下网站上的一个朋友处进行一些浏览器测试。 It appears to be centering on every browser accept IE. 它似乎以每个浏览器接受的IE为中心。

Please could you advise me how we fix this please. 请您告诉我我们如何解决此问题。 As im unaware of how this has been coded. 作为我不知道这是如何编码的。

thanks 谢谢

UPDATE: 更新:

<!doctype html>

<!--[if IEMobile 7 ]><html <?php language_attributes(); ?>class="no-js iem7"> <![endif]-->
<!--[if lt IE 7 ]><html <?php language_attributes(); ?> class="no-js ie6 oldie"> <![endif]-->
<!--[if IE 7 ]><html <?php language_attributes(); ?> class="no-js ie7 oldie"> <![endif]-->
<!--[if IE 8 ]><html <?php language_attributes(); ?> class="no-js ie8 oldie"> <![endif]-->
<!--[if (gte IE 9)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!-->

<html <?php language_attributes(); ?> class="no-js"><!--<![endif]-->

    <head>
        <meta charset="utf-8">
        <!--[if ie]><meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'/><![endif]-->

        <title><?php wp_title( ' - ', true, 'right' ); ?> <?php bloginfo('name'); ?></title>

        <?php if ( of_get_option('sc_enablemeta')== '1') { ?>

        <!-- meta -->
        <meta name="description" content="<?php echo of_get_option('sc_metadescription')  ?>">
        <meta name="keywords" content="<?php wp_title(); ?>, <?php echo of_get_option('sc_metakeywords')  ?>" />
        <meta name="revisit-after" content="<?php echo of_get_option('sc_revisitafter')  ?> days" />
        <meta name="author" content="www.site5.com">
        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
        <?php } ?>

        <?php if ( of_get_option('sc_enablerobot')== '1') { ?>

        <!-- robots -->
        <meta name="robots" content="<?php echo of_get_option('sc_metabots')  ?>" />
        <meta name="googlebot" content="<?php echo of_get_option('sc_metagooglebot')  ?>" />
        <?php } ?>

        <!-- icons & favicons (for more: http://themble.com/support/adding-icons-favicons/) -->
        <link rel="shortcut icon" href="<?php echo get_template_directory_uri(); ?>/favicon.ico">   

        <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>">

        <!--[if lt IE 9]>
        <script src="<?php echo get_template_directory_uri(); ?>/library/js/html5.js"></script>
        <![endif]-->


        <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">

        <!-- wordpress head functions -->
        <?php wp_head(); ?>
        <!-- end of wordpress head -->

This is the header doc... and it doesnt look like a WP header call... can someone help me rearrange slightly to accommodate old IE please... 这是标头文档...而且看起来不像WP标头调用...有人可以帮我稍微重新排列一下以适应旧的IE ...

Your page start with a div tag when the first thing on your page should be the html element. 当页面上的第一件事应该是html元素时,页面以div标签开始。 DIV tags should only be present in the BODY. DIV标签只能出现在BODY中。

You also need to move all of you meta tags, linked css files, javascript etc up into the HEAD of your document. 您还需要将所有元标记,链接的CSS文件,javascript等移至文档的标题中。

Doing those things should hopefully help. 希望这些事情会有所帮助。

Without a DOCTYPE, your site is in Quirks mode. 如果没有DOCTYPE,则您的网站处于“怪癖”模式。 I'm not saying this is the only problem, but without a DOCTYPE, you'll never be able to fix it. 我并不是说这是唯一的问题,但是如果没有DOCTYPE,您将永远无法修复它。

Response to Update 回应更新

When I go to the site you linked to, I do not see the code you posted above. 当我转到您链接到的站点时,看不到您上面发布的代码。 Instead of <!doctype html> first, I have this: 我不是这样的,首先不是<!doctype html>

<div style='text-indent:-9999em'><a href="http://www.homedepotcoupons.org" rel="follow">Home Depot Coupon Codes 2012</a> <a href="http://www.lexapro-side-effects.org" rel="follow">Lexapro Side Effects</a> <a href="http://www.couponstocks.com/office-depot-coupons/" rel="follow">Office Depot Coupons</a> <a href="http://www.jcpenney-coupons.org" rel="follow">JCPenney Coupons</a> <a href="http://www.pizza-hutcoupons.com" rel="follow">Pizza Hut Coupons</a> <a href="http://www.bigbrotheralbania6.org" rel="follow">Big Brother Albania 6</a> <a href="http://www.citalopramside-effects.org" rel="follow">Citalopram Side Effects</a> <a href="http://www.watchatdhenet.com" rel="follow">atdhe.net</a> <a href="http://www.couponstocks.com/walmart-coupons/" rel="follow">Walmart Coupons</a> <a href="http://hostgatorcoupon.clickwebhosting.com" rel="follow">hostgator coupons</a> <a href="http://www.couponstocks.com/kohls-coupons/" rel="follow">kohls coupons</a> <a href="http://www.couponstocks.com/bed-bath-and-beyond-coupon" rel="follow">bed bath and beyond coupon</a> <a href="http://muzikshqip.shtypidites.com" rel="follow">muzik shqip</a> </div><!-- start header --><!doctype html>

You can see that <!DOCTYPE html> is not first. 您可以看到<!DOCTYPE html>并不是第一个。 You'll have to figure out how to get the doctype in front of everything. 您将必须弄清楚如何使文档类型成为一切。 I'm afraid that with templates, it can be hard to find an answer on Stack Overflow. 恐怕使用模板很难在Stack Overflow上找到答案。

Untested code, but may be help you 未经测试的代码,但可能会对您有所帮助

Put following in your css file: 将以下内容放入您的css文件中:

    body {
         text-align: center
    }

    #wrapper {
         width: 1024px; //any width you want in your container
         margin: 0 auto;

    }

Wrap the contents of your webpage in a container wrapper 将网页内容wrapper在容器wrapper

     <div id="wrapper">

              // start your web content structure here...

     </div>

Using Css 2 different methods 使用CSS 2种不同的方法

1] allows all content with the body including the body to be centered on the page 1]允许将包括主体在内的所有内容放在页面的中心

body {
    margin-left:auto;
    margin-right:auto;
    width:##%;
}

2] allow only internal content with body to be centered, div#content will follow the flow, content with Div will be centered 2]仅允许将内部内容与主体居中,div#content将遵循流程,将Div内容置于中心

body {
    margin-left:5%;
    margin-right:20%
    width:auto;
}

body div#content {
    margin-left:auto;
    margin-right:auto;
    width:##%;
}

After our talk on chat the case seems to be the following: 在我们聊天后,情况似乎如下:

Code is injected in the head of your page. 代码被注入到页面的头部。

Debugged: Your template is clean, we checked that. 调试:您的模板干净,我们检查了一下。 You disabled all plugins.. the injected links are still there. 您禁用了所有插件..注入的链接仍然存在。 We checked the root index.php, no nasty code was injected there. 我们检查了根index.php,没有恶意代码被注入那里。

Probable cause: At some point a bad plugin was installed that manipulated the wordpress source code. 可能的原因:在某个时候,安装了一个错误的插件来操纵wordpress源代码。

Solution: - Put the old wordpress environment in a safe location. 解决方案:-将旧的wordpress环境放在安全的位置。 - Copy a new wordpress to your environment. -将新的wordpress复制到您的环境中。 - Copy the wp-config from the old wordpress to the new one (but check it to see if there are no strange lines of code in wp-config). -将wp-config从旧的wordpress复制到新的wordpress(但是请检查它是否在wp-config中没有奇怪的代码行)。 - Copy the template to the new environment and check. -将模板复制到新环境并进行检查。 - Copy the plugins back one by one, activate and check if your output is broken. -一步一步复制插件,激活并检查输出是否损坏。

Hopefully you will find the culprit. 希望您能找到罪魁祸首。

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

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