wojtek
October 14, 2025, 7:33pm
1
Is there any way to use bootstrap/bulma in Anki card template, save for pasting it into the CSS styling section? I was wondering about “additional assets” field of sorts.
There is a 5yo thread (How to find a template's external css file? ) pointing to “global css” : https://anki.tenderapp.com/discussions/ankidesktop/19694-global-css#comment_40775861 but the link is dead…
1 Like
jhhr
October 16, 2025, 7:51pm
2
If you’re looking for a way to include external css files in your Styling, yes you can do that:
move the css file into your collection.media folder,
make sure the file name starts with an underscore (to keep Anki media check from deleting it), e.g. _my_card_styling_stuff.css
and then in each card template where you want to use it, import the file with
@import url(“\_my_card_styling_stuff.css”);
2 Likes
jhhr
October 16, 2025, 7:58pm
3
There’s also a way to import css through javascript, which is useful when some script you use should always be accompanied by an additional css file.
if (!document.getElementById("my_card_styling_stuff")) {
fetch("_my_card_styling_stuff.css")
.then(async (response) => {
const style = document.createElement("style");
style.id = "my_card_styling_stuff";
style.textContent = await response.text();
document.head.appendChild(style);
})
.catch((error) => {
console.error(
"Error loading my_card_styling_stuff CSS:",
error
);
});
}
2 Likes
wojtek
October 16, 2025, 8:41pm
4
Will it be synchronised and work on AnkiDroid as well?
I don’t plan on using JS
jhhr
October 16, 2025, 8:46pm
5
Yes, css files in the collection.media folder get synced through AnkiWeb like any other file.
2 Likes
wojtek
October 17, 2025, 7:12am
6
Perfect. Walks like a charm. Thank you so much! <3
wojtek
October 19, 2025, 5:18am
7
Everything seems to be working fine with CSS, but I tried to use FontAwesome and while it work great with desktop anki, after sync, I get an error: “Error loading ”:
Does font embedding / Font Awesome work with AnkiDroid?
I use a custom font in my card templates and it works fine in Anki and AnkiDroid. I used an actual file for that, not a cdn or similar to fetch the file.
I followed the steps as outlined in the manual: Styling & HTML - Anki Manual .
1 Like
wojtek
October 19, 2025, 12:37pm
9
Thank you!
I was following that and it seems that the problem was using subfolder for fonts.
I had collection.media/_webfonts/_fa-brands-400.woff2 and then referrenced it as
@font-face {
font-family: "Font Awesome 7 Brands";
font-style: normal;
font-weight: 400;
font-display: block;
src: url("_webfonts/_fa-brands-400.woff2");
}
And it couldn’t find it. I put everything in the main collection.media directory and now everything works perfecty <3
1 Like
system
Closed
November 18, 2025, 12:38pm
10
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.