The style element is lost after click the "HTML Editor"


OS: Windows 11
Anki-desktop: 2.1.49(dc80804a)
Anki-desktop: 2.1.50 with qt6

When I use the “HTML Editor” function in 2.1.49, the “<style>…</style>” element is deleted after editing.

The style element is deleted even I never use the “HTML Editor” in 2.1.50.

I think CodeMirror (the JS library for the new HTML editor) strips <style> tags by default and this behavior was kept intentionally. Styles belong in the CSS section of your note template.

If you want to apply CSS to the field contents in the editor, you could use my add-on CSS Injector - Change default editor styles - AnkiWeb.

1 Like