How can I replace the text from the screenshot with any other svg icon (any) using only CSS?
Much appreciated! ![]()
In the discussion From text to icon, Radu asks how to replace text with an SVG icon using CSS. NateDhaliwal responds that the SVG file needs to be uploaded and then referenced in the CSS using a variable name. CocoQuark suggests a helper tool for using icons in CSS.
After some clarification from NateDhaliwal, Radu understands the process. However, Radu then asks if multiple icons need to be uploaded separately, to which NateDhaliwal responds affirmatively. NateDhaliwal also provides an alternative guide for uploading multiple icons at once.
Radu then asks how to use a Font Awesome icon in the CSS content property. NateDhaliwal suggests downloading the icon as an SVG or creating a component. Radu wants to know if itās possible to use a Font Awesome class in the content property, but NateDhaliwal advises against it and recommends uploading the SVG file instead. Ultimately, Radu decides to use Font Awesome as a font family with Unicode characters in the content method.
Youāll need to first upload your SVG file in the Uploads section. For the SCSS variable name, do something short and succint.
Then, add this bit to the Common tab:
th.posts.sortable.num.topic-list-data {
content: url($name-of-variable);
}
Note that you should not put quotes inside of the url parentheses.
Don made a helper tool for using icons in CSS:
Iām sorry, I donāt get it. What do you mean with $name-of-variable? Iām trying to add a SVG code after content:, and itās not working. ![]()
Much appreciated @Canapin, but Iām not looking into installing more components in order to change the word ārepliesā with an SVG code. ![]()
The variable name is the one you entered when you uploaded the SVG file.
You will need to be an Admin to do this.
/admin on the forum.name-of-variable with the name you chose in Step 4. Keep the $ before the variable name.Thank you so much, Itās very clear now.
Quick question: If I have letās say 10 icons, do I need to upload the icons one by one?
Yes, I believe you do.
@Radu In the event my guide doesnāt work, you can follow this guide, where I believe you can just upload 1 file for multiple icons:
This was a great post and it helped me to replace the default icons. One more thing if I mayā¦
In the following, how can I put a FontAwsome icon inside content?
th.topic-list-data.posts.num > span {
visibility: hidden;
}
th.topic-list-data.posts.num > span:after {
content:'a FontAwesome Icon here';
visibility: visible;
display: inline-block;
padding-bottom: 1.2em;
}
You can download it as a SVG and then do the same thing. Otherwise, youāll have to make a component, which will be more complex.
So there is no way of doing something like this?
content:'fa d-icon d-icon-reply';
If not, how would the code look like for the following method? I just need an example from where to start, because I tried basic css and there is no effect.
Kindly appreciated!
No, but you can use the same method as you did with previous methods. Upload it, then add it as an SVG file you followed using the guide;
Iām not too sure where you want to place the icon. Could you send a screenshot?
Thanks.
It doesnāt matter where, I just want to place a FA icon inside the line content:'...'
I think I will go with the FA as a font family and Unicodes inside the content method.
You could do this:
Iām not 100% sure if this works, but Iām quite sure it does.