Add Custom Icon in Ionic 2

后端 未结 10 2045
既然无缘
既然无缘 2020-12-02 06:35

I am using Ionic 2 for developing my App. I want to use my custom icons in my app like we use ionic 2 icons using tag. Eg:



        
10条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-02 07:04

    Create Icon
    ion-icon {
            &[class*="custom-"] {
              mask-size: contain;
              mask-position: 50% 50%;
              mask-repeat: no-repeat;
              background: currentColor;
              width: 0.8em;
              height: 0.8em;
            }
    
            &[class*="custom-rupee"] {
              color: yellow;
              mask-image: url(../../assets/Images/rupee.svg);
            }
            &[class*="custom-ballon"] {
              mask-image: url(../../assets/ballon.svg);
            }
            &[class*="custom-mouse"] {
              mask-image: url(../../assets/mouse.svg);
            }
    
          }
     And to use them
    <ion-icon name="custom-rupee">
    <ion-icon name="custom-mouse">
    <ion-icon name="custom-ballon">
    

提交回复
热议问题