How to make Bootstrap responsive layout work on IE

2020-05-17 09:03发布

I've been search for a while and found some people got it working, but none of them provide any code samples.

I tried their suggestions but it didn't work for me. By suggestions, I tried adding <meta http-equiv="X-UA-Compatible" content="IE=edge" />, respond.js or css3-mediaqueries-js, but none of them helped.

Here's a jsfiddle, if you view it with IE8, you'll see both a and b are on the same row regardless of your browser width.

But if you view with Chrome, FF or IE9 or above, you'll see them on different rows or single row depending on the browser width.

UPDATE

I tried to uncomment one of them (css3-mediaquery, html5shiv and respond) at a time but got no luck with any one of them.

<!DOCTYPE html>
<html lang="en">
<head>
    <title></title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/latest/css/bootstrap-combined.min.css" rel="stylesheet">
</head>

<body>

    <div class="container">
        <div class="row">
            <div class="span4">
                Lorem ipsum dolor sit amet, consectetur adipiscing elit.
            </div>
            <div class="span8">
                LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT.
            </div>
        </div>
    </div>

    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
    <script type="text/javascript" src="http://netdna.bootstrapcdn.com/twitter-bootstrap/latest/js/bootstrap.min.js"></script>

    <%--<script type="text/javascript" src="js/css3-mediaqueries.js"></script>--%>
    <%--<script type="text/javascript" src="js/html5shiv.js"></script>--%>
    <%--<script type="text/javascript" src="js/respond.js"></script>--%>

    </script>
</body>

</html>

10条回答
smile是对你的礼貌
2楼-- · 2020-05-17 09:28

According to: https://drupal.org/node/2173441

To have your Bootstrap site working on IE8 you have to follow this steps:

  1. Install Respond.js files using Respond.js Module.
  2. Disable any CDN to load Bootstrap files.
  3. Install Bootstrap files locally using Bootstrap Library Module.
  4. Aggregate and compress CSS files in /admin/config/development/performance
查看更多
▲ chillily
3楼-- · 2020-05-17 09:29

The issue with CROSS DOMAIN css loads in IE 8 were resolved as suggested by @Akshay Raje and @Craig London.

Just to add to it, respond.js or respond.min.js must be added before respond.proxy.js for the setup to work.

查看更多
淡お忘
4楼-- · 2020-05-17 09:30

Try using html5shiv, its basically a HTML5 IE enabling script and that should get bootstrap working in IE 6,7 and 8. This can also be directly hot linked like this:

<!--[if lt IE 9]>
    <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

It must be included before the <body> element (i.e. in the <head>)

查看更多
在下西门庆
5楼-- · 2020-05-17 09:36

Here's a solution I've been working on that works with the Bones framework. It could be very easily used with bootstrap.

https://github.com/gamsim/ieresponsify

查看更多
登录 后发表回答