Possible Bug? - Styling off when converted, Extra HTML how to remove? :(

I have recently revived my Anki account and started a fresh. In doing so, I have started with new cards without changing any settings. They have begun to appear in the wrong format… I’ve checked the style options, and they are all correct, i.e. centred, but they show on the left. Some cards show correctly, whereas others show on the left, even with the proper formatting.



Does anyone know why? its such a small detail but so annoying!

Thanks :slight_smile:

Probably the front field contains text-align: left? Something like this:

<div style="text-align: left;">Yerno</div>

1 Like

I’ve managed to narrow it down to some cards, the rest are fine. I did convert them from a basic I think to a reversed? Looking at the effected cards, they have this in it:


Any Ideas? Any way of bulk sorting this out?

This is in contrast to:

That seem to show fine:

You can select affected notes in the browser and run this code in the debug console, which will strip all HTML tags from the Back field:

from anki.utils import strip_html
import aqt
from aqt.operations import CollectionOp

notes = []
nids = aqt.dialogs.open("Browser", mw).selected_notes()
for nid in nids:
  note = mw.col.get_note(nid)
  note["Back"] = strip_html(note["Back"])

CollectionOp(mw, lambda col: mw.col.update_notes(notes)).run_in_background()

Please take a backup before running it just in case.


Thats great thank you I will try in the morning

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