There is an extra gap between lines in my cards

    Hello everyone. This is the first time I'm creating a topic on the forum and I'm also new to Anki, so don't judge me harshly.

    I have a problem with how Anki displays information from my template. The displayed info is slightly different when reviewing (as a learning process) from what I can see when editing a card template. The difference also occurs when opening and viewing a card from a preview window in a browser. The problem is that there is extra space between two specific lines. It is much easier to show you that difference from screenshots than explain. This "bug" is in all of my cards that use that card type since the code is the same. As an example, I screenshoted two of my cards from different notes (but the card type is the same). As a solution, I tried everything that was described in the troubleshooting section of the anki manual, but it did not help. Maybe there is some important information in the manual that could help solve the problem, but I didn't find it, so I'm sorry if I missed it if that's the case.











Just to summarize, and make sure I’m on your same track –

  • Study screen – same on the front and back of the card, displayed correctly.
  • Browse Preview – same on the front and back of the card, displayed with unwanted gap.
  • Template editor [Cards... button] – front of the card is displayed correctly, back of the card {{FrontSide}} displayed with unwanted gap.

There are a few different perspectives you can take on this – and hopefully this will sound more like practicality (because that’s how it’s intended) than like harshness :wink: .

A. It looks like you want it to look in the study screen, right? That’s the ultimate test, and it’s just fine. Do you really need a solution to this if it isn’t a problem when you’re studying?

B. If you’re just wondering aloud and looking for an explanation – the preview window and study screen are built in different ways. Inconsistent views between the 2 are not entirely unexpected.

C. If you want things to poke at to try and make a difference – the first thing you can always do to troubleshoot the structure of your card is simplify it and see if that changes things.

  1. These are hint fields. Are they internally already coded to have their own line/div/paragraph break, and you’re inserting another one unnecessarily? Find out by removing the hint: in your template, or the line break between hints 1 and 2.
  2. Try using standard HTML tags in your template instead – e.g., use <br> instead of <br />.
  3. You’re looking at the middle of the spectrum – all the places where your note fields and the card template intertwine – but you’ve skipped over the ends – where you can get the purest look at things.
    • The note end (probably less important here, given the specifics of the situation) – the display-view of the field, and better yet, the underlying HTML-view.
    • The template end – to look at how the template renders without note data getting in the way, go in to the template editor through Manage Note Types > Cards .
1 Like

    First of all, I want to thank you for your reply! Yes, the situation with this "problem" is exactly as you described at the beginning of your message. You even explained it better than I did.


A. Yeah, it is not much of a problem as in the study screen everything is fine (as it intended to be).I thought I might need a solution to this because of two reasons:

  1. I supposed that it may be some sort of a bug that needs to be fixed.
  2. If this is not a bug and it is just the way this application works (as you wrote under B), then I cannot be sure that something like this will not appear in the future when I least expect it. And the problem is that I will be able to see it (the difference) only when opening a card in the study screen. And yes, on the study screen everything looks as I wanted it to but how do I know it will be the case the next time I write something else in the template? I mean, that may become а much bigger problem if it happens from time to time somewhere in the future. I probably need to learn how to avoid situations like this one.

B. Well, I got it. But because of this unwanted gap, it still seems to me that the template editor does not display the contents of the template itself quite correctly. And I used to think that even if the difference appeared between different screens, it would be something else. By the way, in my opinion, it would be nice if the content of a card was displayed on all screens in the same way as the template editor does.

C. I've already tried to make a difference by simplifying the structure of my card but it did not help.

  1. They are not internally coded to have their own break, so I'm not inserting another one unnecessarily. If I remove the line break between those fields (Hint1 and Hint2), they are on the same line. And removing the "hint:" in my template seems to solve the problem, so that there's no unwanted gap on all screens. But I want the content of the field to be hidden as a hint.
  2. I tried to, but it doesn't change anything.
  3. This part of your reply is the most difficult for me to understand. But if I understood you correctly, here is the answer:
    • If you are referring to the contents of the fields when creating a note, for instance, then these fields ("Hint1" and "Hint2") have no HTML elements in them so that the underlying HTML-view is the same as the content itself.
    • I did that and it changed nothing – front of the card is displayed correctly, back of the card {{FrontSide}} displayed with that gap (in the template editor when you go through Tools > Manage Note Types > Cards).


Another question here: Is it considered rude on that forum if I don't mark your answer as a "solution" because it doesn't solves the problem completely or it is recomended to mark it that way if the message helps in any way (to understand the problem better, for example)? Is it enough to like the reply using the "heart" symbol? I really appreciate any attempt to help with the problem or to build better idea of it.

All of your responses made sense to me! :+1:t4:

I think that’s the most promising piece. That makes it seem like it’s happening inside the hint-fields code. Or else that – at least in the template editor where there’s a front/back difference, the {{FrontSide}} special field is doing something different than the actual front template.

Either way, I think you’ve traced this as far as you can. It’s seems like it out of your reach and we’ll leave it up to the devs to say if there’s something fixable about it.


You are welcome to leave your post un-Solution-ed until you feel it has been resolved! There’s nothing rude about that. After all, it’s the best indicator from the outside that a post might need more attention. I don’t think anyone here is focused on their Solution tally – or at least I’m not! Heart-likes are a perfectly fine way to express your appreciation.

1 Like