Card Styling not working

FYI Answer style not working is still an issue. Have 2 cards with identical styling and one of them does not work, also does not work in the Preview when I change the styling. I also imported the cards as in that example and it is an issue for old cards.

The solution described there, cutting and re-pasting the contents works. But I’d rather not cut and paste each field in each card that does not work as it is a large collection.

Version ⁨23.12.1 (1a1d4d54)⁩
Python 3.9.15 Qt 6.6.1 PyQt 6.6.1
linux flatpak

Could you provide more screenshots about your styling and the problem

In your cards, activate the html editor (crtl +shift + x) to see if they aren’t being occupied by number values, (xxx,yyy,zz)

crtl + shift + v → Anki will clean the code and will remove colors, hyperlink, bold…

shift + v → Anki will paste at it is, and this can include colors, formatting, bold…

The problem is related to div tags. Look:

In this notetype, the cloze answer gets surrounded in orange. Example of normal behavior, with br tags:

Now, using divs, the bug shows up. Only the first line is recognized as a cloze answer:

From the Edit window, using the Ctrl + shift + x, before and after cutting and re-pasting the same question:


<font color="#080000" size="3"> question </font>


<span style="color: rgb(8, 0, 0);"> question </span>

But I thought all these settings were set when I click on Cards and in the Styling section of the Template? So that section doesn’t work?

I had HTML turned off on the cards import. When I change the font in the Styling section under the card templates, nothing happens.

Styling definitely works, but these in-field tags overrule it – just like field-specific styling would on the template itself, Styling & HTML - Anki Manual. These tags will always be parsed as special instructions for how to format these specific words.

So how do I fix this? The styling is already in the template:


.card {
    font-family: arial;
    font-size: 20px;
    text-align: center;
    color: black;
    background-color: white;
}

Changing the font size, font family does not work here. I see they have some div tags in the example but I am looking to change the font size.

You need to remove the font, span, div, etc. tags from the fields of your notes.

I imported the cards with HTML import turned off. There may be hundreds or thousands of cards, there is no other way to remove these field-specific tags other than manually?

If you know for certain that you want to get rid of ALL html tags in those fields (including all formatting, url links, images, etc.), you could probably use Find and Replace to do it – Browsing - Anki Manual – especially with a well-formed regex search, like in that example.

Or else you can export the notes as text (Exporting - Anki Manual) to be able to manipulate the data more easily in another program. As long as you’re careful, you should be able to re-import them as an update. Text Files - Anki Manual

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.