html - JSF bootstrap Glyphicons 不显示

标签 html css twitter-bootstrap jsf

在我的网络应用程序中,我使用 Bootstrap 。
Glyphicons 工作得很好,而且没有任何原因就停止了。现在没有图标,只有空方 block 。
我检查了字体文件 - 它们完好无损,只是为了确保我用 3.2 版的新字体替换了它们 - 来自完整版而不是定制器。
我检查了 css 选项 - 一切看起来都很好:

src: url(#{resource['fonts:glyphicons-halflings-regular.eot']}) format('embedded-opentype');
src: url(#{resource['fonts:glyphicons-halflings-regular.woff']}) format('woff');
src: url(#{resource['fonts:glyphicons-halflings-regular.ttf']}) format('truetype');
src: url(#{resource['fonts:glyphicons-halflings-regular.svg']}) format('svg');

我检查了是否加载了 bootstrap.css 文件 - 它是。
现在我被困住了:

  • chrome或firefox控制台没有报错
  • 字体在正确的位置,在 css 文件中正确配置
  • 是最新版本的字体
    我迷路了 - 谁知道接下来要检查什么?

    编辑
    我的配置是 Wildfly 8.1 final,加上 JSF 2.2,bootstrap 3.0,仅此而已。

    编辑 2
    正如我的同事刚刚告诉我的那样,这个问题是在将我们的应用程序从 Jboss 7.2 迁移到 Wildfly 8.0 后首次注意到的,所以这可能就是原因。

  • 最佳答案

    将字体添加到 /webapp/resources/fonts 然后编辑您正在使用的 LESS 或 CSS,更改 @font-face block 以匹配以下内容:

    @font-face {
        font-family: 'Glyphicons Halflings';
        src: url("#{resource['fonts/glyphicons-halflings-regular.eot']}");
        src: url("#{resource['fonts/glyphicons-halflings-regular.eot']}?#iefix") format('embedded-opentype'),
                url("#{resource['fonts/glyphicons-halflings-regular.woff']}") format('woff'),
                url("#{resource['fonts/glyphicons-halflings-regular.ttf']}") format('truetype'),
                url("#{resource['fonts/glyphicons-halflings-regular.svg']}#glyphicons-halflingsregular") format('svg');
    }
    

    在这里查看我的帖子:http://www.samael.me.uk/2014/02/how-to-use-bootstrap-3-in-your-java-web.html

    编辑: 我建议在编译后的 CSS 上使用 LESS,它更容易使用,你可以通过调整变量文件或放入主题来轻松改变整个外观。您还可以查看使用 http://www.webjars.org/

    编辑2: 可能是 wildfly 不知道如何提供字体。我不熟悉 wildfly(通常使用 Tomcat)但正在查看 related issue elsewhere看来您可能需要:

    <mime-mapping>
        <extension>eot</extension>
        <mime-type>application/vnd.ms-fontobject</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>ttf</extension>
        <mime-type>application/font-sfnt</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>woff</extension>
        <mime-type>application/font-woff</mime-type>
    </mime-mapping>
    

    关于html - JSF bootstrap Glyphicons 不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26488005/

    相关文章:

    javascript - jQuery 控制动态元素创建

    Javascript更改最后一个子标签内容

    html - 将类型 ="password"更改为类型 ="text"的安全问题

    html - 显示嵌套的 div 失败

    javascript - 获取所选选项的 src

    html - Bootstrap 导航栏左右浮动

    javascript - dragula - 如何禁用在其父容器中的拖动

    css html 5 菜单在某些页面上向左移动

    css - Google map 未显示 div 背景颜色集

    jquery - 带有 Bootstrap 的 Yeoman : How to choose jQuery version?