简体   繁体   中英

Website centre alignment in IE

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.

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

Your page start with a div tag when the first thing on your page should be the html element. DIV tags should only be present in the BODY.

You also need to move all of you meta tags, linked css files, javascript etc up into the HEAD of your document.

Doing those things should hopefully help.

Without a DOCTYPE, your site is in Quirks mode. I'm not saying this is the only problem, but without a DOCTYPE, you'll never be able to fix it.

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:

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

Untested code, but may be help you

Put following in your css file:

    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

     <div id="wrapper">

              // start your web content structure here...

     </div>

Using Css 2 different methods

1] allows all content with the body including the body to be centered on the page

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

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.

Probable cause: At some point a bad plugin was installed that manipulated the wordpress source code.

Solution: - Put the old wordpress environment in a safe location. - Copy a new wordpress to your environment. - 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). - 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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