How to Left-Align Text in Anki

How to Left-Align Text in Anki

A single-line word stays centered; a sentence that wraps past two lines reads better left-aligned — that's really the whole rule. Anki's default template centers the whole card, so once an example sentence or explanation gets long enough, each line starts at a different position and reading gets awkward. Click the part you want to change in ankieditor, then press [Left] under Alignment in "Text Style".

Why Is Anki's Default Template Centered?

Anki's built-in note types (Basic, Basic (type in the answer), Cloze) have .card { text-align: center; } in their styling. It's built around the simplest possible card — one word and a one-line meaning. For short content, sitting in the middle of the screen draws the eye well, so it's a reasonable default.

The problem is that the rule applies to the whole card. Even after you add an example sentence, pronunciation, or explanation later, the alignment stays centered. The default never grows along with the card.

When Should You Switch to Left Alignment?

The rule is simple: center a single line, left-align anything that wraps past two.

  • A single line like a word or its meaning — center. It's fine to let it sit big in the middle of the card.
  • An example sentence or explanation that runs two lines or more — left. This is the case this article covers.
  • Lists or numbered content — left. Centering makes the bullet position shift from line to line.
  • Code or formulas — left. Content where indentation carries meaning doesn't work with center alignment.

The reason comes down to how your eyes move. With center alignment, every line starts at a different horizontal position, so after finishing one line your eyes have to hunt anew for where the next one starts. On a single card that's a tiny cost, but it adds up once you review hundreds a day. Left alignment keeps every line starting at the same point, so your eyes glide straight down.

How to Switch to Left Alignment in ankieditor

  1. Click the part you want to change in the preview to select it. Clicking empty space selects the whole card.
  2. Press [Left] under Alignment in the left panel's "Text Style".
  3. To change only the example sentence field, click that field to select it, then press the same button. Keeping the whole card centered while left-aligning just the example sentence is a combination that comes up a lot in practice.
  4. Use [Copy Code] to copy the updated code and paste it into Anki's Tools → Manage Note Types → Cards... screen.

The CSS ankieditor Actually Generates

Changing the whole card updates the .card rule in the styling area.

.card { text-align: left; }

Changing just one field makes ankieditor issue a class named after that field and write the rule there. Left-aligning the example sentence field looks like this.

.card { text-align: center; }
.Example { text-align: left; }

Having both rules together doesn't cause a conflict — they target different elements. The centering on .card is inherited by everything inside it, but the example sentence field has a .Example rule set directly on it, so that value is used instead of the inherited one. Anki Desktop, AnkiDroid, and AnkiMobile all render cards in a webview, so this CSS generally applies the same way in every environment.

Things to Watch Out For

text-align is inherited by child elements. If you set left on .card, every field inside it becomes left-aligned too. To keep just the word centered, select that field and set it back to [Center].

Justified text (justify) isn't recommended. Because a card is narrow and only a few words fit per line, the spacing between words ends up uneven from line to line, which reads worse than centered text.

Set this separately for each note type. Card templates are stored in the card types that belong to a note type, so if you use several note types, you'll need to apply it to each one.

Frequently Asked Questions

Can I left-align the whole card in Anki?

Yes. Change text-align to left on .card in the styling. Since Anki renders cards in a webview, regular CSS applies as-is, and there's no extra restriction on Anki's side.

Can I left-align just one field?

Yes. In ankieditor, click that field to select it and press [Left] — the rule gets written to a class named after the field. You can mix approaches, like keeping the whole card centered and only left-aligning the example sentence.

I left-aligned the card, but some lines are still centered.

That usually means a separate alignment is set on that part. Click that element to select it and press [Left] again. ankieditor clears out inline styles that conflict with the property it's about to apply and writes it to the rule instead, so pressing the button once more fixes it.

For a way to build priority with font size, see How to Change Font Size in Anki; for adjusting line spacing when a paragraph feels cramped, see How to Change Line Spacing in Anki.