0

我正在使用 Bootstrap 4.3.1 并尝试使用卡片创建视图。我遇到的问题是卡片在 chrome 和其他浏览器中显示得非常好,而在 Internet Explorer 11 中显示不正确

<div class="row">
                    <div class="col-sm-4 pt-3 pb-3">
                        <div class="card card-body bg-light">
                            <h2>Heading</h2>
                            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra codeply varius quam sit amet vulputate.

                            <hr />
                            <div class="row">
                                <span class="pl-2">
                                    <i class="far fa-clock"></i>
                                </span>
                                <span class="ml-auto pr-2 text-success">
                                    <i class="far fa-check-circle"></i>
                                    Complete
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4 pt-3 pb-3">
                        <div class="card card-body bg-light">
                            <h2>Heading</h2>
                            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra codeply varius quam sit amet vulputate.

                            <hr />
                            <div class="row">
                                <span class="pl-2">
                                    <i class="far fa-clock"></i>
                                </span>
                                <span class="ml-auto pr-2 text-success">
                                    <i class="far fa-check-circle"></i>
                                    Complete
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4 pt-3 pb-3">
                        <div class="card card-body bg-light">
                            <h2>Heading</h2>
                            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra codeply varius quam sit amet vulputate.
                            <hr />
                            <div class="row">
                                <span class="pl-2">
                                    <i class="far fa-clock"></i>
                                </span>
                                <span class="ml-auto pr-2 text-success">
                                    <i class="far fa-check-circle"></i>
                                    Complete
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-4 pt-3 pb-3">
                        <div class="card card-body bg-light">
                            <h2>Heading</h2>
                            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra codeply varius quam sit amet vulputate.
                            <hr />
                            <div class="row">
                                <span class="pl-2">
                                    <i class="far fa-clock"></i>
                                </span>
                                <span class="ml-auto pr-2 text-success">
                                    <i class="far fa-check-circle"></i>
                                    Complete
                                </span>
                            </div>
                        </div>
                    </div>
                </div>

您可以在图像中看到我在 chrome 中获得正确的输出,而在 IE 中它被挤出。

铬工作图像

IE 11 输出

Internet Explorer 不工作图像

4

1 回答 1

0

我将您的代码添加到 bootstrap 的启动模板中,它工作正常。确保您正在导入正确的文件:

<!doctype html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">

    <title>Hello, world!</title>
  </head>
  <body>
    <div class="row">
        <div class="col-sm-4 pt-3 pb-3">
            <div class="card card-body bg-light">
                <h2>Heading</h2>
                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra codeply varius quam sit amet vulputate.

                <hr />
                <div class="row">
                    <span class="pl-2">
                        <i class="far fa-clock"></i>
                    </span>
                    <span class="ml-auto pr-2 text-success">
                        <i class="far fa-check-circle"></i>
                        Complete
                    </span>
                </div>
            </div>
        </div>
        <div class="col-sm-4 pt-3 pb-3">
            <div class="card card-body bg-light">
                <h2>Heading</h2>
                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra codeply varius quam sit amet vulputate.

                <hr />
                <div class="row">
                    <span class="pl-2">
                        <i class="far fa-clock"></i>
                    </span>
                    <span class="ml-auto pr-2 text-success">
                        <i class="far fa-check-circle"></i>
                        Complete
                    </span>
                </div>
            </div>
        </div>
        <div class="col-sm-4 pt-3 pb-3">
            <div class="card card-body bg-light">
                <h2>Heading</h2>
                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra codeply varius quam sit amet vulputate.
                <hr />
                <div class="row">
                    <span class="pl-2">
                        <i class="far fa-clock"></i>
                    </span>
                    <span class="ml-auto pr-2 text-success">
                        <i class="far fa-check-circle"></i>
                        Complete
                    </span>
                </div>
            </div>
        </div>
        <div class="col-sm-4 pt-3 pb-3">
            <div class="card card-body bg-light">
                <h2>Heading</h2>
                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pharetra codeply varius quam sit amet vulputate.
                <hr />
                <div class="row">
                    <span class="pl-2">
                        <i class="far fa-clock"></i>
                    </span>
                    <span class="ml-auto pr-2 text-success">
                        <i class="far fa-check-circle"></i>
                        Complete
                    </span>
                </div>
            </div>
        </div>
    </div>


    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
  </body>
</html>

IE 11 输出:

在此处输入图像描述

于 2020-03-02T09:25:17.200 回答