簡體   English   中英

IE中的網站中心對齊

[英]Website centre alignment in IE

http://atomtk.co.uk/

我正在以下網站上的一個朋友處進行一些瀏覽器測試。 它似乎以每個瀏覽器接受的IE為中心。

請您告訴我我們如何解決此問題。 作為我不知道這是如何編碼的。

謝謝

更新:

<!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 -->

這是標頭文檔...而且看起來不像WP標頭調用...有人可以幫我稍微重新排列一下以適應舊的IE ...

當頁面上的第一件事應該是html元素時,頁面以div標簽開始。 DIV標簽只能出現在BODY中。

您還需要將所有元標記,鏈接的CSS文件,javascript等移至文檔的標題中。

希望這些事情會有所幫助。

如果沒有DOCTYPE,則您的網站處於“怪癖”模式。 我並不是說這是唯一的問題,但是如果沒有DOCTYPE,您將永遠無法修復它。

回應更新

當我轉到您鏈接到的站點時,看不到您上面發布的代碼。 我不是這樣的,首先不是<!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>

您可以看到<!DOCTYPE html>並不是第一個。 您將必須弄清楚如何使文檔類型成為一切。 恐怕使用模板很難在Stack Overflow上找到答案。

未經測試的代碼,但可能會對您有所幫助

將以下內容放入您的css文件中:

    body {
         text-align: center
    }

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

    }

將網頁內容wrapper在容器wrapper

     <div id="wrapper">

              // start your web content structure here...

     </div>

使用CSS 2種不同的方法

1]允許將包括主體在內的所有內容放在頁面的中心

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

2]僅允許將內部內容與主體居中,div#content將遵循流程,將Div內容置於中心

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

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

在我們聊天后,情況似乎如下:

代碼被注入到頁面的頭部。

調試:您的模板干凈,我們檢查了一下。 您禁用了所有插件..注入的鏈接仍然存在。 我們檢查了根index.php,沒有惡意代碼被注入那里。

可能的原因:在某個時候,安裝了一個錯誤的插件來操縱wordpress源代碼。

解決方案:-將舊的wordpress環境放在安全的位置。 -將新的wordpress復制到您的環境中。 -將wp-config從舊的wordpress復制到新的wordpress(但是請檢查它是否在wp-config中沒有奇怪的代碼行)。 -將模板復制到新環境並進行檢查。 -一步一步復制插件,激活並檢查輸出是否損壞。

希望您能找到罪魁禍首。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM