javascript - How to use svg icons just like "font awesome" icons - Stack Overflow

I am new to front-end development. And one of the sample project that I am going through uses "fon

I am new to front-end development. And one of the sample project that I am going through uses "font awesome" icons instead of images. Font-Awesome Link And every where instead of <img src> all I find is <i class= "">. I researched a little and found out these icons are basically svg files. So, I created couple of svg files for learning purpose. But I don't know how to correctly include svg files.

Question 1: So I am putting svg files in my own project and calling them like <img src = "images/sms_connect_logo.svg"/>. I am able to see the icon but is it the right way to add icons. I wanted to use something like <i class = "blabla"> to get the desired result as its done in sample project.

Question 2: Currently, the icon I have created is of black colour. I want it to be light gray in colour. So do I need to create another SVG file of same icon with light gray colour so the same black icon can be changed to gray by some css tweaking. (Using the Power of SVG files).

I am totally new so I might not have asked question the right way. Please let me know if I am missing something.

Thanks!

I am new to front-end development. And one of the sample project that I am going through uses "font awesome" icons instead of images. Font-Awesome Link And every where instead of <img src> all I find is <i class= "">. I researched a little and found out these icons are basically svg files. So, I created couple of svg files for learning purpose. But I don't know how to correctly include svg files.

Question 1: So I am putting svg files in my own project and calling them like <img src = "images/sms_connect_logo.svg"/>. I am able to see the icon but is it the right way to add icons. I wanted to use something like <i class = "blabla"> to get the desired result as its done in sample project.

Question 2: Currently, the icon I have created is of black colour. I want it to be light gray in colour. So do I need to create another SVG file of same icon with light gray colour so the same black icon can be changed to gray by some css tweaking. (Using the Power of SVG files).

I am totally new so I might not have asked question the right way. Please let me know if I am missing something.

Thanks!

Share Improve this question edited Aug 26, 2016 at 17:14 Unbreakable asked Aug 26, 2016 at 17:10 UnbreakableUnbreakable 8,13224 gold badges108 silver badges191 bronze badges 2
  • You a looking for Sprites – Christian Gollhardt Commented Aug 26, 2016 at 17:13
  • fontawesome.io – Unbreakable Commented Aug 26, 2016 at 17:15
Add a ment  | 

1 Answer 1

Reset to default 5

I use Ioon to build a custom icon font. You can import icons from fontawesome and other icon libraries, plus add your own very easily.

It is also nice because you are able to select only the icons you need for your app, which can greatly reduce the size of the css and font files

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742416374a4439819.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信