1

I am using bootstrap with a theme from bootswatch with html5 boiler plate to create a page. Although it displays correctly in Chrome and Firefox, it doesn't display correctly in IE9 and IE8 mode. However, it works correctly when I set IE9 to use compatibility mode. The problem is that in IE9 without compatibility mode , the page does not align itself and stays at the left. Would like to know where I went wrong. Thanks in advance!

<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!-- Consider adding a manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
  <meta charset="utf-8">

  <!-- Use the .htaccess and remove these lines to avoid edge case issues.
       More info: h5bp.com/i/378 -->
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title></title>
  <meta name="description" content="">
  <!-- Mobile viewport optimized: h5bp.com/viewport -->
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
  <!-- Place favicon.ico and apple-touch-icon.png in the root directory: mathiasbynens.be/notes/touch-icons -->
  <link rel="stylesheet" href="css/bootstrap.css">
  <!-- More ideas for your head here: h5bp.com/d/head-Tips -->

  <!-- For the sticky footer -->
    <!--[if !IE 7]><style type="text/css">#sf-wrapper {display:table;height:100%}</style><![endif]-->
  <style>
      #content-main {
        padding-top:63px;
       }

      #form-language {
        margin-top: 15px;
      }
  </style>
  <!-- All JavaScript at the bottom, except this Modernizr build.
       Modernizr enables HTML5 elements & feature detects for optimal performance.
       Create your own custom Modernizr build: www.modernizr.com/download/ -->
  <script src="extras/h5bp/js/libs/modernizr-2.5.3.min.js"></script>
</head>

The code is here: http://jsfiddle.net/WWphP/

Sameera Thilakasiri
  • 9,452
  • 10
  • 51
  • 86
Hong Yi
  • 569
  • 2
  • 13
  • 29
  • Have you run your page through the HTML Validator yet? – Sparky Jul 04 '12 at 17:18
  • yes i have ran it through html validator and i don't think it would affect how the page came out. Line 13, Column 64: Bad value X-UA-Compatible for attribute http-equiv on element meta. – Hong Yi Jul 04 '12 at 17:19
  • There's a problem with how you're using jsFiddle. You are not supposed to include the `doctype`, the entire `` section, or any `` tags in the HTML box. Only the code from _inside_ the `` tags goes there. jsFiddle is putting your code inside their container page and likely your `head` content is ignored or duplicated. The way you've set it up makes an unreliable demo. – Sparky Jul 04 '12 at 17:22
  • ah. i'm really sorry about that but the same problem still exists even though it is unreliable. – Hong Yi Jul 04 '12 at 17:25

1 Answers1

2
<!--[if !IE 7]><style type="text/css">#sf-wrapper {display:table;height:100%}</style><![endif]-->

The code above is your problem, basically you say if it isn't IE7 use this code which also includes IE9. Your #sf-wrapper element is set to display: table; which makes it's width as wide as the content inside is (940px), just set #sf-wrapper to width:100% and it will be centered.

Igor Jerosimić
  • 13,621
  • 6
  • 44
  • 53