Issue importing HTML with styling

I’m having a problem with CSV import which includes fields with HTML that provides color to the text. I checked “Allow HTML in fields”, so it imports properly. However when I view the cards the style isn’t applied.

The only way I’ve been able to get the styling to apply is open the editor for the card, and then open the HTML editor for the relevant field with Ctrl+Shift+x, then simply close it again. The color will then properly appear. I don’t have to change anything, simply viewing the field in the HTML editor is enough.

I’ve tried doing a database check and closing and re-opening Anki, exporting and re-importing but nothing causes the color to show other than going to each individual card and opening the relevant field in the HTML editor then closing again. It’s like Anki doesn’t read the HTML attributes until this is done.

Has anyone encountered this problem getting HTML attributes to properly apply following an import? Any suggestions for how to get round this without having to manually do this for every card?

I had experienced a behaviour as your describe when the HTML tags syntax was not properly used i.e no closing tag, missing “<” etc. Sometimes Anki can still display the card even if end tags are missing and the content is simple, for images attributes not properly finished ANki does what you are experiencing.

Are you positive the HTML code in your cards are following a proper syntax?


Ah good catch. Sorry, I was pretty sure it was correct, but that was a simple fix in the end. The HTML is automatically generated and the way it was produced was cutting off a closing tag. Turns out opening and closing the HTML editor was actually automatically adding that closing tag for me.