【问题标题】:Feather css icons İs not working羽毛 css 图标不起作用
【发布时间】:2018-03-13 06:53:08
【问题描述】:

我应该使用羽毛 css 图标,但是图标不适用于我的 mvc 项目。我尝试更改文件路径,但它再次不起作用。

@font-face {
  font-family: "feather";
  src: url('../fonts/feather.eot?t=1501841394106'); /* IE9*/
  src: url('../fonts/feather.eot?t=1501841394106#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('../fonts/feather.woff?t=1501841394106') format('woff'), /* chrome, firefox */
  url('../fonts/feather.ttf?t=1501841394106') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
  url('../fonts/feather.svg?t=1501841394106#feather') format('svg'); /* iOS 4.1- */
}

@font-face {
  font-family: "feather";
  src: url('../fonts/feather.eot?t=1501841394106'); /* IE9*/
  src: url('../fonts/feather.eot?t=1501841394106#iefix') format('embedded-opentype'), /* IE6-IE8 */
  url('../fonts/feather.woff?t=1501841394106') format('woff'), /* chrome, firefox */
  url('../fonts/feather.ttf?t=1501841394106') format('truetype'), /* chrome, firefox, opera, Safari, Android, iOS 4.2+*/
  url('../fonts/feather.svg?t=1501841394106#feather') format('svg'); /* iOS 4.1- */
}

.feather {
  /* use !important to prevent issues with browser extensions that change fonts */
  font-family: 'feather' !important;
  speak: none;
  font-style: normal;
  font-weight: normal;
  font-variant: normal;
  text-transform: none;
  line-height: 1;

  /* Better Font Rendering =========== */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.icon-alert-octagon:before { content: "\e81b"; }

.icon-alert-circle:before { content: "\e81c"; }

.icon-activity:before { content: "\e81d"; }

.icon-alert-triangle:before { content: "\e81e"; }

.icon-align-center:before { content: "\e81f"; }

.icon-airplay:before { content: "\e820"; }

.icon-align-justify:before { content: "\e821"; }

.icon-align-left:before { content: "\e822"; }

.icon-align-right:before { content: "\e823"; }
.
.
.
.

【问题讨论】:

  • 您是否在浏览器中检查了当它下载字体时,它以 HTTP 200 而不是 404 结尾?真正的问题:你真的确定你的 URI 是正确的吗?如果我是你,我会检查浏览器发出的请求,从中了解 URL 错误的原因,并在我的代码中修复 URI。

标签: javascript html css icons feather


【解决方案1】:

跨域请求被阻止(原因:CORS 请求不是 http)。它发生在本地,您可以下载羽毛字体并将字体文件粘贴到您尊重的字体文件夹中,然后用新文件替换您的网址并完成。

【讨论】:

  • 似乎 OP 使用这种方法,因为 url 中有“../fonts/”
猜你喜欢
  • 2018-10-06
  • 1970-01-01
  • 2019-12-12
  • 1970-01-01
  • 1970-01-01
  • 2018-08-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多