当我使用 CDN 而不是使用下载的 .css 文件远程托管时,Bootstrap CDN 不工作

问题描述 投票:0回答:3

CDN 加载失败,因为当我在浏览器中查看时样式不显示。请调查它,让我知道问题是什么,因为我很难调试。我几乎要放弃了,即将成为一个独身者。请帮忙!!!

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

<head>
  <title>Project</title>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>

<body>
  <div class="jumbotron">
    <h1 class="display-4">Hello, world!</h1>
    <p class="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
    <hr class="my-4">
    <p>It uses utility classes for typography and spacing to space content out within the larger container.</p>
    <a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a>
  </div>
</body>

</html>

html css cdn
3个回答
0
投票

我在加载 CDN 引导文件时看不到任何问题。它对我有用。请检查您的浏览器设置。


0
投票

它适用于 Bootstrap 4.1.3 样式表。最好在头部添加 2 个元。 上的文档 https://getbootstrap.com/docs/4.1/getting-started/introduction/

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Project</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
    integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
</head>

0
投票

您可以在 app.js 文件中使用以下导入,而不是 cdn 文件

导入“bootstrap/dist/css/bootstrap.min.css”;

导入“bootstrap/dist/js/bootstrap.bundle.min.js”;

并且不要忘记添加

npm i [email protected]

© www.soinside.com 2019 - 2024. All rights reserved.