针对twitter-bootstrap–Bootstrap–Sass:相对的glyphicons图标路径和twitter的图标的含义这两个问题,本篇文章进行了详细的解答,同时本文还将给你拓展Boots
针对twitter-bootstrap – Bootstrap – Sass:相对的glyphicons图标路径和twitter的图标的含义这两个问题,本篇文章进行了详细的解答,同时本文还将给你拓展Bootstrap Glyphicons图标、css – Heroku上的twitter-bootstrap-rails:显示为正方形的Glyphicons、css – 中心Twitter Bootstrap 3按钮中的Glyphicons、twitter-bootstrap – Bootstrap 3 glyphicons在附加等相关知识,希望可以帮助到你。
本文目录一览:- twitter-bootstrap – Bootstrap – Sass:相对的glyphicons图标路径(twitter的图标的含义)
- Bootstrap Glyphicons图标
- css – Heroku上的twitter-bootstrap-rails:显示为正方形的Glyphicons
- css – 中心Twitter Bootstrap 3按钮中的Glyphicons
- twitter-bootstrap – Bootstrap 3 glyphicons在附加
twitter-bootstrap – Bootstrap – Sass:相对的glyphicons图标路径(twitter的图标的含义)
默认情况下,css font-face中使用的路径是绝对路径.
@font-face { font-family: ''Glyphicons Halflings''; src: url(/fonts/bootstrap/glyphicons-halflings-regular.eot?1422262129); src: url(/fonts/bootstrap/glyphicons-halflings-regular.eot?&1422262129#iefix) format("embedded-opentype"),url(/fonts/bootstrap/glyphicons-halflings-regular.woff2?1422262129) format("woff2"),url(/fonts/bootstrap/glyphicons-halflings-regular.woff?1422262129) format("woff"),url(/fonts/bootstrap/glyphicons-halflings-regular.ttf?1422262129) format("truetype"),url(/fonts/bootstrap/glyphicons-halflings-regular.svg?1422262129#glyphicons_halflingsregular) format("svg"); }
但是我需要一个相对的:“../ fonts / bootstrap” – 所以在文件_bootstrap-variables.scss中,我设置了$icon-font-path
$icon-font-path: "../fonts/bootstrap/"
给出以下内容
@font-face { font-family: ''Glyphicons Halflings''; src: url(/fonts/../fonts/bootstrap/glyphicons-halflings-regular.eot?1422262129); src: url(/fonts/../fonts/bootstrap/glyphicons-halflings-regular.eot?&1422262129#iefix) format("embedded-opentype"),url(/fonts/../fonts/bootstrap/glyphicons-halflings-regular.woff2?1422262129) format("woff2"),url(/fonts/../fonts/bootstrap/glyphicons-halflings-regular.woff?1422262129) format("woff"),url(/fonts/../fonts/bootstrap/glyphicons-halflings-regular.ttf?1422262129) format("truetype"),url(/fonts/../fonts/bootstrap/glyphicons-halflings-regular.svg?1422262129#glyphicons_halflingsregular) format("svg"); }
在网络上,我找到了在变量之前包含“bootstrap-sprockets”的提示,结果是
@font-face { font-family: ''Glyphicons Halflings''; src: url(font-path("../fonts/bootstrap/glyphicons-halflings-regular.eot")); src: url(font-path("../fonts/bootstrap/glyphicons-halflings-regular.eot?#iefix")) format("embedded-opentype"),url(font-path("../fonts/bootstrap/glyphicons-halflings-regular.woff2")) format("woff2"),url(font-path("../fonts/bootstrap/glyphicons-halflings-regular.woff")) format("woff"),url(font-path("../fonts/bootstrap/glyphicons-halflings-regular.ttf")) format("truetype"),url(font-path("../fonts/bootstrap/glyphicons-halflings-regular.svg#glyphicons_halflingsregular")) format("svg"); }
网址本身似乎没问题 – 但这个“字体路径”来自何处,我该如何摆脱它呢?
或者是否有另一种指定相对路径的方法?我错了什么?
解决方法
app.scss
// your bootstrap default overrides here $icon-font-path: ''../fonts/bootstrap/''; @function font-path($path) { @return $path; } @import ''bootstrap-sprockets''; @import ''bootstrap''; // your application styles here
有点黑客,我不确定是否还有其他任何东西不能用这样的设置(不使用指南针),但它似乎对我来说是有用的.
Bootstrap Glyphicons图标
<!DOCTYPE html>
<html>
<head>
<title>Bootstrap Example</title>
<link href = /bootstrap/css/bootstrap.min.css rel = stylesheet>
<script src = /scripts/jquery.min.js></script>
<script src = /bootstrap/js/bootstrap.min.js></script>
</head>
<body>
<p>The following are the icons:</p>
<p>
<button type = button class = btn btn-default>
<span class = glyphicon glyphicon-print></span>
</button>
<button type = button class = btn btn-default>
<span class = glyphicon glyphicon-search></span>
</button>
<button type = button class = btn btn-default>
<span class = glyphicon glyphicon-download></span>
</button>
</p>
</body>
</html>
css – Heroku上的twitter-bootstrap-rails:显示为正方形的Glyphicons
起初我认为这是一个问题,图标精灵没有被预编译,所以在我的gemfile中,我将“gem twitter-bootstrap-rails”行移出资产组,我确信在上传之前预先编译了我的所有资产到Heroku.
但是,这并没有解决问题.检查页面后,似乎图标可用,但链接到它们的CSS属性被另一个将background-image设置为none的CSS规则覆盖.它似乎发生在作为twitter bootstrap一部分的样式表中,所以我不太清楚为什么会这样.
有没有其他人有这个问题?
解决方法
[class^="icon-"],[class*=" icon-"] { display: inline; width: auto; height: auto; line-height: inherit; vertical-align: baseline; background-image: none; background-position: 0% 0%; background-repeat: repeat;
是Fontawesome的一部分,默认包含在twitter-bootstrap-rails中.问题是Fontawesome图标文件没有被预编译,因为它们是不寻常的文件类型.我进入了production.rb环境文件,并在config.assets.precompile列表中添加了’.woff’,’.eot’,’.svg’,’.ttf’.然后我重新编译了我的资产,图标出现了!繁荣.
css – 中心Twitter Bootstrap 3按钮中的Glyphicons
图标和文本具有相同的底线,但我相信一个好看的按钮图标应该基于文本居中,应该不是吗?任何想法如何实现这一点?
http://bootply.com/74652
解决方法
<button> <span></span> Centered </button>
Demo
twitter-bootstrap – Bootstrap 3 glyphicons在附加
.input-group input.form-control(type='text') span.input-group-addon.glyphicon.glyphicon-calendar
但是,插件不与输入字段对齐。快照:
是正常的还是bootstrap 3中的错误?
更新
得到它了:
在bootstrap.css:2171(用较少编译)
.glyphicon{ ...; top: 1px; ...}
Bug?
解决方法
我先阅读这个https://github.com/twbs/bootstrap/issues/9850。
我使用这个代码:
<div> <br> <div> <span></span> <input type="text"placeholder="Username"> </div> <br> <div> <span></span> <input type="text"placeholder="Username"> </div> <br> <div> <input type="text"placeholder="Username"> <span></span> </div> <br> <div> <input type="text"placeholder="Username"> <span></span> </div> <br> <div> <input type="text"placeholder="Username"> <span></span> </div> <br> <div> <input type="text"placeholder="Username"> <span></span> </div> <br> <div> <input type="text"placeholder="Username"> <span><span></span></span> </div> <br> </div>
Firefox的搜索结果:
:
对于input-group-lg会有一个问题,双跨度使输入更长(由于.glyphicon:empty),但没有解决问题。
我也没有找到.glyphicon {…; top:1px; …}引起这个问题。
对于firefox我发现这个解决方案:
从bootstrap.css:
.input-group-lg > .form-control,.input-group-lg > .input-group-addon,.input-group-lg > .input-group-btn > .btn { height: 45px; padding: 10px 16px; font-size: 18px; line-height: 1.33; border-radius: 6px; }
将垂直填充从10px更改为9px解决了问题。
这个css规则来自forms.less(来自inputgroups.less的.input-lg()调用)
using @ padding-large-vertical:10px; (从variables.less)
在google chrome我发现了同样的问题,对于所有尺寸见:
在这种情况下,它有助于使用双跨:
`<span><span></span></span>`
今天的关于twitter-bootstrap – Bootstrap – Sass:相对的glyphicons图标路径和twitter的图标的含义的分享已经结束,谢谢您的关注,如果想了解更多关于Bootstrap Glyphicons图标、css – Heroku上的twitter-bootstrap-rails:显示为正方形的Glyphicons、css – 中心Twitter Bootstrap 3按钮中的Glyphicons、twitter-bootstrap – Bootstrap 3 glyphicons在附加的相关知识,请在本站进行查询。
本文标签: