我使用了'查看源页面',并在bootstrap网站上获取了此示例中的所有html:http://getbootstrap.com/examples/carousel/
除了一件小事之外,它使用Django在我的localhost上顺利运行。滑动转盘内的灰盒子没有出现?奇怪的是,如果我将所有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
我不知道该怎么办,因为我是新的bootstrap而且我通常只使用一个简单的外部css文件。我是否应该在django上的资产文件夹中看到新的css文件?因为我没有。我很想让灰色的盒子出现,但我很难过。
答案 0 :(得分:0)
您似乎没有正确挂钩您的资产(即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