我使用了“查看源代码页面”并从 Bootstrap 网站上的这个示例中获取了所有 html:http://getbootstrap.com/examples/carousel/
除一件小事外,它使用 Django 在我的本地主机上运行顺利。滑动轮播中的那个灰色框没有出现?奇怪的是,如果我将所有 html 放入 JSfiddle,它也会丢失。
我已经包含了 CSS 并且可以完美地用于页面上的其他所有内容:
<link rel="icon" href="../../favicon.ico">
<link href="carousel.css" rel="stylesheet">
<link href="../../dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
所以我的 Django 页面看起来完全像这样:http://jsfiddle.net/yU9zE/1/
Funkylaundry 发现某些 CSS 出于某种原因未加载。他使用名为 firebug 的调试工具发现了这个警告/错误:
Failed to load resource: the server responded with a status of 404 (Not Found) http://fiddle.jshell.net/yU9zE/1/show/carousel.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://fiddle.jshell.net/yU9zE/dist/css/bootstrap.min.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://fiddle.jshell.net/yU9zE/assets/js/ie10-viewport-bug-workaround.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://fiddle.jshell.net/yU9zE/assets/js/ie-emulation-modes-warning.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://fiddle.jshell.net/yU9zE/dist/js/bootstrap.min.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://fiddle.jshell.net/yU9zE/assets/js/docs.min.js
我不确定该怎么做,因为我是新手,我通常只使用一个简单的外部 css 文件。我是否也应该在 django 的 Assets 文件夹中看到新的 css 文件?因为我没有。我很想让灰色框出现,但我很难过。
最佳答案
您似乎没有正确 Hook 您的 Assets (即 carousel.css 从未加载)。如果你检查你的开发者工具/firebug 或你正在使用的任何东西,你会看到一堆 404:
Failed to load resource: the server responded with a status of 404 (Not Found) http://fiddle.jshell.net/yU9zE/1/show/carousel.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://fiddle.jshell.net/yU9zE/dist/css/bootstrap.min.css
Failed to load resource: the server responded with a status of 404 (Not Found) http://fiddle.jshell.net/yU9zE/assets/js/ie10-viewport-bug-workaround.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://fiddle.jshell.net/yU9zE/assets/js/ie-emulation-modes-warning.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://fiddle.jshell.net/yU9zE/dist/js/bootstrap.min.js
Failed to load resource: the server responded with a status of 404 (Not Found) http://fiddle.jshell.net/yU9zE/assets/js/docs.min.js
关于html - Bootstrap 示例不呈现灰色框。其他都好吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24747364/