I want to achieve an effect where only the text of cloze cards is formatted in a certain way and REMAINS formatted when another cloze card is shown.
I have tried to achieve this with span: nth-child CSS tags but it doesn’t work as well as I intended, because I also wanted every nth cloze card text to be formatted differently.
span:nth-child(1) {
color: #FFff00; /* Light blue color for odd span elements */
}
span:nth-child(2){
color: #00FF; /* Gold color for even span elements */
}
span:nth-child(3)
color: #ffffff; /* Gold color for even span elements */
}
span:nth-child(4)
color: #ffffff; /* Gold color for even span elements */
}
span:nth-child(7)
color: #ffffff; /* Gold color for even span elements */
}
I’m not sure I quite understood how you wanted each cloze span to be formatted but perhaps these tips will let you figure it out:
The cloze spans have a css class cloze or cloze-inactive and an attribute data-ordinal="X" attribute where X is the cloze number. These would let you target specific clozes as active or inactive letting you precisely select how each individual cloze is styled.
/* Targets the first cloze, when it's active */
span.cloze[data-ordinal="1"] {
color: red;
}
/* Targets the first cloze, when it's inactive */
span.cloze-inactive[data-ordinal="1"] {
color: blue;
}
/* Targets the second cloze, when it's active */
span.cloze[data-ordinal="2"] {
color: green;
}
/* Targets the second cloze, when it's inactive */
span.cloze-inactive[data-ordinal="2"] {
color: purple;
}
/* etc... */
It worked! But only for the first 3 cloze cards in my note though. I need this to keep on looping for ever. In that order, over and over again so that every cloze card is coloured in that order.
For example:
Every nth cloze card is red
Every nth+1 cloze card is blue
Every nth+2 cloze card is purple
Nice! I actually thought nth-of-type wouldn’t work here because you can’t target the value in a css attribute with it that but actually leaving the value out of the targeting works.
That can be fixed with adding an additional targeting on the active cloze. On the card front, the active cloze has an additional attribute data-cloze which it won’t have on the card back. Then the css targeter :not([data-cloze]) will exclude the active cloze from being targeted only the card front:
Hmm sorry to bother you again. But I wish for a slight adjustment: I would like the cloze card being focused in the question to retain its old color by the normal formatting. For example, green.