# Card Styling not working

**URL:** <https://forums.ankiweb.net/t/card-styling-not-working/40529>\
**Category:** Help\
**Created:** [January 30, 2024, 9:30pm UTC](https://forums.ankiweb.net/t/card-styling-not-working/40529 "2024-01-30T21:30:57Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![nmjkjm](https://avatars.discourse-cdn.com/v4/letter/n/67e7ee/32.png) [@nmjkjm](https://forums.ankiweb.net/u/nmjkjm)\
**Post date:** [January 30, 2024, 9:30pm UTC](https://forums.ankiweb.net/t/card-styling-not-working/40529/1 "2024-01-30T21:30:57Z")

</div>

FYI [Answer style not working](https://forums.ankiweb.net/t/answer-style-not-working/9166) is still an issue. Have 2 cards with identical styling and one of them does not work, also does not work in the Preview when I change the styling. I also imported the cards as in that example and it is an issue for old cards.

The solution described there, cutting and re-pasting the contents works. But I’d rather not cut and paste each field in each card that does not work as it is a large collection.

Version ⁨23.12.1 (1a1d4d54)⁩  
Python 3.9.15 Qt 6.6.1 PyQt 6.6.1  
linux flatpak

---

<div class="post-metadata">

**Author:** ![NameLessGO](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/namelessgo/32/34298_2.png) [@NameLessGO](https://forums.ankiweb.net/u/NameLessGO)\
**Post date:** [January 31, 2024, 3:39am UTC](https://forums.ankiweb.net/t/card-styling-not-working/40529/2 "2024-01-31T03:39:29Z")

</div>

Could you provide more screenshots about your styling and the problem

In your cards, activate the html editor (crtl +shift + x) to see if they aren’t being occupied by number values, (xxx,yyy,zz)

crtl + shift + v → Anki will clean the code and will remove colors, hyperlink, bold…

shift + v → Anki will paste at it is, and this can include colors, formatting, bold…

---

<div class="post-metadata">

**Author:** ![davidcortez](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@davidcortez](https://forums.ankiweb.net/u/davidcortez)\
**Post date:** [January 31, 2024, 12:49pm UTC](https://forums.ankiweb.net/t/card-styling-not-working/40529/3 "2024-01-31T12:49:42Z")

</div>

The problem is related to div tags. Look:

In this notetype, the cloze answer gets surrounded in orange. Example of normal behavior, with br tags:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/5/6/56282f4938455fdbad12a11640ff6b59389bc0ad.png)

Now, using divs, the bug shows up. Only the first line is recognized as a cloze answer:

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

---

<div class="post-metadata">

**Author:** ![nmjkjm](https://avatars.discourse-cdn.com/v4/letter/n/67e7ee/32.png) [@nmjkjm](https://forums.ankiweb.net/u/nmjkjm)\
**Post date:** [January 31, 2024, 4:35pm UTC](https://forums.ankiweb.net/t/card-styling-not-working/40529/4 "2024-01-31T16:35:20Z")

</div>

From the Edit window, using the Ctrl + shift + x, before and after cutting and re-pasting the same question:

```auto

<font color="#080000" size="3"> question </font>

<span style="color: rgb(8, 0, 0);"> question </span>

```

But I thought all these settings were set when I click on Cards and in the Styling section of the Template? So that section doesn’t work?

I had HTML turned off on the cards import. When I change the font in the Styling section under the card templates, nothing happens.

---

<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:** [January 31, 2024, 7:23pm UTC](https://forums.ankiweb.net/t/card-styling-not-working/40529/5 "2024-01-31T19:23:26Z")

</div>

> [@nmjkjm](#):
>
> But I thought all these settings were set when I click on Cards and in the Styling section of the Template? So that section doesn’t work?

Styling definitely works, but these in-field tags _overrule_ it – just like field-specific styling would on the template itself, [Styling & HTML - Anki Manual](https://docs.ankiweb.net/templates/styling.html#field-styling). These tags will always be parsed as special instructions for how to format these specific words.

---

<div class="post-metadata">

**Author:** ![nmjkjm](https://avatars.discourse-cdn.com/v4/letter/n/67e7ee/32.png) [@nmjkjm](https://forums.ankiweb.net/u/nmjkjm)\
**Post date:** [February 1, 2024, 8:04pm UTC](https://forums.ankiweb.net/t/card-styling-not-working/40529/6 "2024-02-01T20:04:01Z")

</div>

> [@Danika\_Dakika](#):
>
> Styling definitely works, but these in-field tags _overrule_ it – just like **field-specific styling would on the template itself,** [Styling & HTML - Anki Manual](https://docs.ankiweb.net/templates/styling.html#field-styling). These tags will always be parsed as special instructions for how to format these specific words.

So how do I fix this? The styling is already in the template:

```auto

.card {
    font-family: arial;
    font-size: 20px;
    text-align: center;
    color: black;
    background-color: white;
}

```

Changing the font size, font family does not work here. I see they have some div tags in the example but I am looking to change the font size.

---

<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 1, 2024, 8:33pm UTC](https://forums.ankiweb.net/t/card-styling-not-working/40529/7 "2024-02-01T20:33:52Z")

</div>

You need to remove the font, span, div, etc. tags from the _fields_ of your notes.

---

<div class="post-metadata">

**Author:** ![nmjkjm](https://avatars.discourse-cdn.com/v4/letter/n/67e7ee/32.png) [@nmjkjm](https://forums.ankiweb.net/u/nmjkjm)\
**Post date:** [February 2, 2024, 1:04am UTC](https://forums.ankiweb.net/t/card-styling-not-working/40529/8 "2024-02-02T01:04:42Z")

</div>

I imported the cards with HTML import turned off. There may be hundreds or thousands of cards, there is no other way to remove these field-specific tags other than manually?

---

<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 2, 2024, 1:29am UTC](https://forums.ankiweb.net/t/card-styling-not-working/40529/9 "2024-02-02T01:29:24Z")

</div>

If you know for certain that you want to get rid of _ **ALL** _ html tags in those fields (including all formatting, url links, images, etc.), you could probably use Find and Replace to do it – [Browsing - Anki Manual](https://docs.ankiweb.net/browsing.html#find-and-replace) – especially with a well-formed regex search, like in that example.

Or else you can export the notes as text ([Exporting - Anki Manual](https://docs.ankiweb.net/exporting.html#text-files)) to be able to manipulate the data more easily in another program. As long as you’re careful, you should be able to re-import them as an update. [Text Files - Anki Manual](https://docs.ankiweb.net/importing/text-files.html#duplicates-and-updating)

---

<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 3, 2024, 1:29am UTC](https://forums.ankiweb.net/t/card-styling-not-working/40529/10 "2024-03-03T01:29:51Z")

</div>

Closed on March 3, 2024, 1:29am UTC

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