XF 2.2 How to add custom icon in widget?

Agentos

Active member
I'm trying to figure it out how to add a custom icon in a widget. I don't mean the Font Awesome icons. I want these to be my own or the Material Icons

This code not working

CSS:
/* member widget*/
.p-body-sidebar [data-widget-key="ranking"] .block-minorHeader:before {;   
    font-family: "Material Icons";
    content: "star";
    padding-right: 9px;
    display: inline-block;
}
 
If you don't need the image to be clickable it's easy to do with a background image:

Code:
.p-body-sidebar [data-widget-id="56"] .block-container

{       
background-image:url("path_to_image");
    padding-top:50px;
    background-size:50px 50px;
    background-position:center top;
    background-repeat:no-repeat;
}
 
How did you "activate" Material Icons on you forum ?
I have the opportunity to test the style in which these icons are installed

How did you "activate" Material Icons on you forum ?


CSS:
[data-widget-key="ranking"] {
    .block-minorHeader:before {  
        content: url("/path/to/the/icon.png");
        padding-right: 9px;
    }
}
If you don't need the image to be clickable it's easy to do with a background image:

Code:
.p-body-sidebar [data-widget-id="56"] .block-container

{      
background-image:url("path_to_image");
    padding-top:50px;
    background-size:50px 50px;
    background-position:center top;
    background-repeat:no-repeat;
}
These css codes also don't work in the default style
 
Yes they do. perhaps you have the wrong image path for your icon?
Yes, the path must be wrong, because the code worked with the link. Your code doesn't work at all, and both code doesn't work in the main style.

code1working.webpcode1notworking.webp

CSS:
[data-widget-key="online_now"] {
    .block-minorHeader:before {   
       content: url("https://i.imgur.com/n1CNnme.png");
        padding-right: 9px;
    }
}
 
Top Bottom