CSS Bootstrap 4 IE 11 不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46502273/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 12:44:09  来源:igfitidea点击:

Bootstrap 4 IE 11 does not work

cssinternet-explorersassinternet-explorer-11twitter-bootstrap-4

提问by Lisa

so I have the problem, that my whole website does not work in IE 11. I don't get why because officially IE 11 should be supported by bootstrap 4... Website: www.ergotherapie-klinkicht.de I'm a bit helpless right now, because I don't know where to start. Did I miss something for IE 11 to inlcude in my code?

所以我有一个问题,我的整个网站在 IE 11 中不起作用。我不明白为什么,因为 IE 11 应该由引导程序 4 正式支持......网站:www.ergotherapie-klinkicht.de 我有点现在很无助,因为我不知道从哪里开始。我是否错过了 IE 11 在我的代码中包含的内容?

In Firefox, , Edge, Chrome and Safari it works just fine...

在 Firefox、Edge、Chrome 和 Safari 中它工作得很好......

Because right now, I have the feeling that bootstrap 4 is not compatible for IE 11 at all...

因为现在,我觉得 bootstrap 4 根本不兼容 IE 11 ......

Thanks for any reply!

感谢您的任何回复!

this is my navbar for example, it is not visible in IE 11:

例如,这是我的导航栏,它在 IE 11 中不可见:

#logonav {

   height: 40px; 
    width: auto;
}

/* change the link color */
.navbar-custom .navbar-nav .nav-link {
    color: #2E8B57;
}
/* change the color of active or hovered links */
.navbar-custom .nav-item .nav-link .active,
.navbar-custom .nav-item:hover .nav-link {
    color: orangered; 
}

/* change the brand and text color */
.navbar-custom .navbar-brand,
.navbar-custom .navbar-text {
    color: #2E8B57;
}

.custom-toggler.navbar-toggler {
    border-color: rgb(46,139,87);
}
.custom-toggler .navbar-toggler-icon {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg viewBox='0 0 32 32' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath stroke='rgba(46, 139, 87, 1)' stroke-width='2' stroke-linecap='round' stroke-miterlimit='10' d='M4 8h24M4 16h24M4 24h24'/%3E%3C/svg%3E");

}

<!DOCTYPE html>
<html lang="de">

<head>
    <meta charset="UTF-8">
    <!-- IE Edge Meta Tag -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- Viewport -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="x-ua-compatible" content="ie=edge">
    <!-- Minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwtheitroadesjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ"
        crossorigin="anonymous">
    <link rel="stylesheet" href="ergo.css">
    <title>Bettina Klinkicht Ergotherapeutische Praxis Bonn</title>
    <link rel="shortcut icon" type="image/x-icon" class="img-circle" href="logopur.png">
    <!-- Global Site Tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-107069424-1"></script>
    <script>
        window.dataLayer = window.dataLayer || [];
        function gtag() { dataLayer.push(arguments) };
        gtag('js', new Date());

        gtag('config', 'UA-107069424-1');
    </script>
</head>
<body>
 <nav class="navbar navbar-inverse fixed-top transparent navbar-toggleable-sm navbar-custom">
        <div class="navbar-inner">
            <!-- Brand and toggle grouped for better mobile display -->
            <button class="navbar-toggler navbar-toggler-right custom-toggler" type="button" data-toggle="collapse" data-target="#navmobile"
                aria-controls="navmobile" aria-expanded="false" aria-label="Toggle Navigation">
        <span class="navbar-toggler-icon"></span>
    </button>

            <a href="home.html" class="navbar-brand"><img src="logopur_neu.png" alt="Logo" id="logonav"></a>
        </div>
        <!-- Collect nav-links for toggling-->
        <div class="collapse navbar-collapse" id="navmobile">
            <div class="navbar-nav ml-auto">
                <a class="nav-item nav-link active" href="#">Home</a>
                <a class="nav-item nav-link" href="Therapeutin.html">über mich</a>

                <div class="dropdown">
                    <a class="nav-item nav-link dropdown-toggle" href="#" data-toggle="dropdown" id="servicesDropdown" aria-haspopup="true" aria-expanded="false">Angebot</a>
                    <div class="dropdown-menu" aria-labelledby="servicesDropdown">
                        <a class="dropdown-item" href="Geriatrie.html">Geriatrie</a>
                        <a class="dropdown-item" href="Neurologie.html">Neurologie</a>
                        <a class="dropdown-item" href="Spiegeltherapie.html">Spiegeltherapie</a>
                        <a class="dropdown-item" href="Schwindeltherapie.html">Schwindeltherapie</a>
                        <a class="dropdown-item" href="Biographiearbeit.html">Biographiearbeit</a>
                        <a class="dropdown-item" href="Brain_Gym.html">Brain Gym</a>
                        <a class="dropdown-item" href="Sensibilitaetstraining.html">Sensibilit?tstraining</a>
                        <a class="dropdown-item" href="Gleichgewichtstraining.html">Gleichgewichtstraining</a>
                    </div>
                </div>

                <a class="nav-item nav-link" href="Kontakt.html">Kontakt</a>
            </div>
        </div>
        </div>
        </div>
    </nav>
        <script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n"
        crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb"
        crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn"
        crossorigin="anonymous"></script>
    <script src="ergo.js"></script>
</body>
</html>

回答by Caverman

Posting just in case this could help someone else. I ran into the same issue where everything ran just fine in Chrome but in IE11 it acted like it could not see any CSS. I came across this post but it didn't help. After more searching I found a suggestion to add the following in the HEAD tag and it worked. Figured I would post here since this is one of the first threads that comes up in a Google search.

发布以防万一这可以帮助其他人。我遇到了同样的问题,在 Chrome 中一切正常,但在 IE11 中它表现得好像看不到任何 CSS。我遇到了这篇文章,但没有帮助。经过更多搜索后,我发现了在 HEAD 标签中添加以下内容的建议并且它起作用了。我想我会在这里发帖,因为这是 Google 搜索中出现的第一个线程。

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

回答by Kaune

In IE, the height and width need to be set explicitly or it breaks.

在 IE 中,需要显式设置高度和宽度,否则会中断。

So the width: automight be causing a problem. autogives me a lot of problems. Maybe give that a try

所以这width: auto可能会导致问题。auto给我带来很多问题。也许试一试

回答by flashy

I had a display issue using IE11 when using the class .card-deck I fixed this by adding

使用 .card-deck 类时,我在使用 IE11 时遇到了显示问题,我通过添加解决了这个问题

.card-deck {
    width: 100% !important;
}

回答by user2676091

I had the same problem. You have to close all the meta and link tags in your head with a />.

我有同样的问题。你必须用 /> 关闭你头脑中的所有元和链接标签。

回答by Mohammed Ajmal

align-self-centerclass helped me fix the issue in ie11

align-self-center类帮助我解决了 ie11 中的问题