【发布时间】:2026-02-10 02:15:02
【问题描述】:
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>
【问题讨论】:
-
您不能在 bootstrap 3 中使用 bootstrap 4 类。更多信息请参阅getbootstrap.com/docs/4.1/getting-started/introduction的快速入门
-
该文档并没有帮助我很好地理解我的问题背后的下划线概念。
-
请详细描述一下到底是什么问题。我认为你的代码可以运行。
-
当我运行代码(使用 CDN)时,我得到的只是没有引导程序的基本样式。 PS:您能否向我解释一下两个版本的不同之处,因为我们所做的只是将编写好的代码粘贴到我们的文档中(除非我们想自己定制)
-
您从 Bootstrap 4 中获取了这个示例 getbootstrap.com/docs/4.1/components/jumbotron,但是从 Bootstrap 3 中插入了样式表。BS3 和 BS4 之间有很多不同之处。您只需更改此行
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">即可。