text 使用Open Iconic SVG定义来定义图标

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 使用Open Iconic SVG定义来定义图标相关的知识,希望对你有一定的参考价值。

/* ==========================================================================
   SVG to CSS Example: Breadcrumbs "Home Icon"
   - an example of using the Open Iconic SVG code to create a "home" icon
   - this is the same method as used in the Bootstrap 4 _variables.sccs file
   - started by downloading the distro from https://useiconic.com/open
   - found the 'home' icon SVG and copied its path code
   - then pasted the path code into one of the Bootstrap icon definitions &
     changed the fill color
   ========================================================================== */
$link-color: blue;
$link-hover-color: red;
$home-icon-bg: str-replace(url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='#{$link-color}' viewBox='0 0 8 8'%3E%3Cpath d='M4 0l-4 3h1v4h2v-2h2v2h2v-4.03l1 .03-4-3z'/%3E%3C/svg%3E"), "#", "%23");
$home-icon-hover-bg: str-replace(url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='#{$link-hover-color}' viewBox='0 0 8 8'%3E%3Cpath d='M4 0l-4 3h1v4h2v-2h2v2h2v-4.03l1 .03-4-3z'/%3E%3C/svg%3E"), "#", "%23");
.breadcrumbs .home-icon {
   display: inline-block;
   width: 1rem;
   height: 1rem;
   background: transparent no-repeat center center;
   background-size: 100% 100%;
   background-image: $home-icon-bg;
   text-decoration: none;
   color: transparent;
   &:hover,
   &:focus {
      text-decoration: none;
      background-image: $home-icon-hover-bg;
   }
}

以上是关于text 使用Open Iconic SVG定义来定义图标的主要内容,如果未能解决你的问题,请参考以下文章

使用带有外部定义的 SVG

svg是啥格式啊

SVG文本

如何在本地将 Material Design Iconic Font 托管到 vue 应用中

如何使用 Angular 6 中的自定义指令来呈现动态生成的内联 SVG

SVG 文本