The problem occurs both when editing and when reviewing.
Japanese characters, both Kanji and Hiragana, don’t align, totally ignoring any CSS-prescribed alignment.
Here’s the code, in case it was somehow my mistake, although I doubt it given the fact that all it took to align the English text on the same card is just text-align: center;
.
Card type HTML and CSS
It’s been a hot minute since I used HTML last, so forgive any bad class names or the fact that I have a whole “english” class for no reason, haha.
Front template:
<div id="kanjiDiv">
<div class="kanji">
{{Kanji}}
</div>
</div>
Back template:
{{FrontSide}}
</br>
<hr id=answer>
</br>
<div id=pronounciation>
<div class=hiragana>
{{Pronounciation - Hiragana}}
</div>
<div class=romanji lang=jp>
{{Pronounciation - Romaji}}
</div>
</div>
</br>
<div id=meaningDiv>
<div class=english>
{{Meaning}}
</div>
</div>
CSS:
(Note the obvious center alignment in .card)
.card {
font-family: sans-serif;
font-size: 20px;
text-align: center;
color: black;
background-color: white;
}
#pronounciation .hiragana {
font-family: Droid Sans Fallback;
color: MidnightBlue;
text-align: center;
}
#pronounciation .romanji {
font-size: 18px;
color: SlateGrey;
}
#kanjiDiv .kanji {
font-size: 28px;
color: black;
}
#meaningDiv .english {
font-size: 20px;
color: black;
}
Things I’ve tried:
- Adding
lang="jp"
orlang="ja-jp"
to the offending HTML elements - Googling. I found this one question that seemed similar, but was 4 years old and offered no solution.
- adding
text-align: center;
in each of the CSS scope-things (I’m sorry about the lack of appropriate terminology, it’s been a while since I last used HTML/CSS) - restarting Anki
- changing to a Japanese font - note the Hiragana part is in the font Droid Sans Fallback.
I’d love some pointers toward solving this? Would honestly be awkward if this is some trivial thing, but I always make a point of going through all the FAQs and Googling everything before posting for help, so I hope that’s not the case.
(I’m using Ubuntu 20.04 LTS, Anki Desktop 2.1.34. No errors are logged to the console or anything when this happens.)