作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是新手,所以请帮忙;-)
我构建了一个小型 RoR Web 应用程序,我试图在其中使用 twitter bootstrap.js 框架。
我几乎所有东西都可以工作,但显示的图标应该是 glyphicons-halflings-white.png 或 glyphicons-halflings.png 。
我的文件夹结构非常简单,即标准 RoR 项目,我将 png 文件放在/app/assets/images/下,当我查看 bootstrap.css 文件时,我看到:
background-image: url("../images/glyphicons-halflings-white.png");
background-image: url("../images/glyphicons-halflings.png");
<div class="btn-group">
<button class="btn" id="addTagButton"><i class="icon-tag"></i>Add Tag</button>
<button class="btn dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div>
<i class="icon-tag"></i>
显示标签图标(或希望看到它)
../images/glyphicons-halflings.png
是否可以看到 png 文件但是,到浏览器地址 url,当 url 指向:localhost:3000/images/glyphicons-halflings.png 时,我得到“没有路由匹配 [GET]”/images/glyphicons-halflings.png
<!DOCTYPE html>
<html>
<head>
<link href="/assets/application.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/bootstrap-responsive.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/bootstrap.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/chosen.css?body=1" media="all" rel="stylesheet" type="text/css" />
<link href="/assets/jquery-ui.css?body=1" media="all" rel="stylesheet" type="text/css" />
<script src="/assets/jquery.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery.min.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery-ui.1.8.20.min.js?body=1" type="text/javascript"></script>
<script src="/assets/jquery.extentions.js?body=1" type="text/javascript"></script>
<script src="/assets/application.js?body=1" type="text/javascript"></script>
<script src="/assets/select2.js?body=1" type="text/javascript"></script>
<link href="/assets/select2.css?body=1" media="screen" rel="stylesheet" type="text/css" />
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js" type="text/javascript"></script>
<meta content="authenticity_token" name="csrf-param" />
<meta content="c+czIHCNmepmx674gKldijipFRD9348Gw+R2SAlrpow=" name="csrf-token" />
<link rel="SHORTCUT ICON" href="/images/favicon.ico">
</head>
<body>
<script src="/assets/jquery.validate.js?body=1" type="text/javascript"></script>
<script src="/assets/jit-yc.js?body=1" type="text/javascript"></script>
<script src="/assets/graphcontrol.js?body=1" type="text/javascript"></script>
<script src="/assets/excanvas.js?body=1" type="text/javascript"></script>
<!--[if IE]><script language="javascript" type="text/javascript" src="/assets/excanvas.js"></script><![endif]-->
<h1>Sandbox#hello</h1>
<div class="btn-group">
<button class="btn" id="addTagButton"><i class="icon-tag"></i>Add Tag</button>
<button class="btn dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="#">Another action</a></li>
<li><a href="#">Something else here</a></li>
<li class="divider"></li>
<li><a href="#">Separated link</a></li>
</ul>
</div>
<script src="/assets/bootstrap-dropdown.js?body=1" type="text/javascript"></script>
<script src="/assets/bootstrap-button.js?body=1" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.dropdown-toggle').dropdown();
});
</script>
</body>
</html>
最佳答案
我有一个类似的问题,所以我这样做了:
<i class="icon-shopping-cart glyphw" id="cart"></i>
.glyphw{
background-image: url(/assets/glyphicons-halflings-white.png);
}
关于ruby-on-rails - Twitter Bootstrap 图标不显示 - 我做错了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12488659/
我是一名优秀的程序员,十分优秀!