8000 GitHub - islomirzo/icon-svg: This CSS trick allows you to use SVG images as icons
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

islomirzo/icon-svg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

icon-svg

This CSS trick allows you to use SVG images as icons

HTML

<!-- Default -->
<i class="icon icon-face-smile"></i>
<i class="icon icon-face-wink"></i>

<!-- Sample with css color -->
<i class="icon icon-face-neutral" style="color: red;"></i>
<i class="icon icon-face-sad" style="color: red;"></i>

<!-- Sample with css size -->
<i class="icon icon-face-content"></i>
<i class="icon icon-face-happy"></i>

Scss

$path-icons: '../svg-icons';

// Icons list
$icons:
        'face-smile',
        'face-wink',
        'face-neutral',
        'face-sad',
        'face-content',
        'face-happy',
;

@mixin icon-size($size: 1rem) {
  width: $size;
  min-width: $size;
  height: $size;
  min-height: $size;
}

.icon {
  display: inline-block;
  mask-size: contain;
  -webkit-mask-size: contain;
  mask-position: center;
  -webkit-mask-position: center;
  mask-repeat: no-repeat;
  -webkit-mask-repeat: no-repeat;
  background-color: currentcolor;
  @include icon-size();
}

@each $icon in $icons {

  .icon-#{$icon} {
    mask-image: url("#{$path-icons}/#{$icon}.svg");
    -webkit-mask-image: url("#{$path-icons}/#{$icon}.svg");
  }
}

About

This CSS trick allows you to use SVG images as icons

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0