# HTML markup, formating lost in Ankidroid

**URL:** <https://forums.ankiweb.net/t/html-markup-formating-lost-in-ankidroid/40953>\
**Category:** Help\
**Created:** [February 10, 2024, 11:47am UTC](https://forums.ankiweb.net/t/html-markup-formating-lost-in-ankidroid/40953 "2024-02-10T11:47:17Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![FGFlan](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/fgflan/32/673_2.png) [@FGFlan](https://forums.ankiweb.net/u/FGFlan)\
**Post date:** [February 10, 2024, 11:47am UTC](https://forums.ankiweb.net/t/html-markup-formating-lost-in-ankidroid/40953/1 "2024-02-10T11:47:17Z")

</div>

I’ve created a flash card which uses HTML markup to create an HTML table alongside the text within the card. When I view it in Anki desktop it’s perfect…

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/0/f/0f55c442b7f44887927e489de4cea34d47c49f01.png)

When I view the card with Ankidroid the formatting is lost. I had to use 2 screenshots as a page of space appears between the front and back of the card.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/e/1/e1a8a1252bb64c8fdb16a876822c4c04b16c8102.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/d/2/d25f16753beaef3ce49464cb30183503e675a041.png)

What am I missing that this is happening? Incidentally I’ve checked it in paid Anki on an iPad and it’s perfect.

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [February 10, 2024, 8:44pm UTC](https://forums.ankiweb.net/t/html-markup-formating-lost-in-ankidroid/40953/2 "2024-02-10T20:44:19Z")

</div>

> [@FGFlan](#):
>
> When I view it in Anki desktop it’s perfect…

What does the underlying HTML look like in AnkiDesktop (or AnkiDroid – because they should match)? Whatever is in there is being read differently by AnkiDroid. [Post it here in a code block/as pre-formatted text, in case someone needs to experiment with it.]

---

<div class="post-metadata">

**Author:** ![FGFlan](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/fgflan/32/673_2.png) [@FGFlan](https://forums.ankiweb.net/u/FGFlan)\
**Post date:** [February 13, 2024, 1:20pm UTC](https://forums.ankiweb.net/t/html-markup-formating-lost-in-ankidroid/40953/3 "2024-02-13T13:20:25Z")

</div>

Here’s the HTML…

```auto
In the table below where would you add the scope attribue in the table's markup to tell screen readers exactly what cells the header is a header for — 
is it a header for the row it is in, or the column?<br><br>

 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width">
 <title>Items sold summary</title>
 

 <style>
 html {
 font-family: sans-serif;
    }

 table {
 border-collapse: collapse;
 border: 2px solid rgb(200, 200, 200);
 letter-spacing: 1px;
 font-size: 0.8rem;
    }

 td,
 th {
 border: 1px solid rgb(190, 190, 190);
 padding: 10px 20px;
    }

 th {
 background-color: rgb(235, 235, 235);
    }

 td {
 text-align: center;
    }

 tr:nth-child(even) td {
 background-color: rgb(250, 250, 250);
    }

 tr:nth-child(odd) td {
 background-color: rgb(245, 245, 245);
    }

 caption {
 padding: 10px;
    }
 </style>

  <table>
 <caption>Items Sold August 2016</caption>
 <thead>
 <tr>
 <td colspan="2" rowspan="2"></td>
 <th colspan="3">Clothes</th>
 <th colspan="2">Accessories</th>
 </tr>
 <tr>
 <th>Trousers</th>
 <th>Skirts</th>
 <th>Dresses</th>
 <th>Bracelets</th>
 <th>Rings</th>
 </tr>
 </thead>
 <tbody>
 <tr>
 <th rowspan="3">Belgium</th>
 <th>Antwerp</th>
 <td>56</td>
 <td>22</td>
 <td>43</td>
 <td>72</td>
 <td>23</td>
 </tr>
 <tr>
 <th>Gent</th>
 <td>46</td>
 <td>18</td>
 <td>50</td>
 <td>61</td>
 <td>15</td>
 </tr>
 <tr>
 <th>Brussels</th>
 <td>51</td>
 <td>27</td>
 <td>38</td>
 <td>69</td>
 <td>28</td>
 </tr>
 <tr>
 <th rowspan="2">The Netherlands</th>
 <th>Amsterdam</th>
 <td>89</td>
 <td>34</td>
 <td>69</td>
 <td>85</td>
 <td>38</td>
 </tr>
 <tr>
 <th>Utrecht</th>
 <td>80</td>
 <td>12</td>
 <td>43</td>
 <td>36</td>
 <td>19</td>
 </tr>
 </tbody>
 </table><br>Do this for the following rows or columns.<br>?: Clothes, Accessories<br>?:&nbsp;Trousers, Skirts, Dresses, Bracelets, Rings<br>?:&nbsp;Belgium, Netherlands<br>?:&nbsp;Antwerp, Gent, Brussels, Amsterdam, Utrecht

```

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [February 13, 2024, 8:40pm UTC](https://forums.ankiweb.net/t/html-markup-formating-lost-in-ankidroid/40953/4 "2024-02-13T20:40:29Z")

</div>

I think this might be a manifestation of this behavior - [Bug report: Newlines duplicated within fields - #6 by dae](https://forums.ankiweb.net/t/bug-report-newlines-duplicated-within-fields/40884/6) . You have all that “invisible” header information in your field (as opposed to your template), so if you edit the note in AnkiDroid, it is re-parsing the newlines as linebreaks `<br>`.

Possible solutions for the time-being –

- Don’t edit notes with complex HTML in AnkiDroid
- Settings \> Advanced \> Workarounds \> Replace newlines \> toggle off

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [February 13, 2024, 9:00pm UTC](https://forums.ankiweb.net/t/html-markup-formating-lost-in-ankidroid/40953/5 "2024-02-13T21:00:25Z")

</div>

It looks like when you sync this back to AnkiDesktop, it will bring that mess of `<br>`s with it.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/2/c/2cd6c44959b3fbe70e5c6b5b9ca9da142ed6ed6c.png)

If you don’t have too many impacted notes, you can fix them by hand. Probably easiest to copy the HTML into a smart text editor (like Notepad++), replace the `<br>`s with `\n` newlines, and then paste the fixed HTML back into AnkiDesktop.

---

<div class="post-metadata">

**Author:** ![FGFlan](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/fgflan/32/673_2.png) [@FGFlan](https://forums.ankiweb.net/u/FGFlan)\
**Post date:** [February 14, 2024, 7:12pm UTC](https://forums.ankiweb.net/t/html-markup-formating-lost-in-ankidroid/40953/6 "2024-02-14T19:12:23Z")

</div>

Much appreciated Danika. I’ve experiemented with both options and also now know how to view what a card is going to look like without having to to into edit mode with a card so this should no longer happen. I’ve also turned off ‘Replace newlines with HTML’ as well. So double insurance.

😀

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [March 15, 2024, 7:12pm UTC](https://forums.ankiweb.net/t/html-markup-formating-lost-in-ankidroid/40953/7 "2024-03-15T19:12:34Z")

</div>

Closed on March 15, 2024, 7:12pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
