Here is my source code:
I am trying to change the font color using only CSS.
This is how I am inserting HTML:
<span class="tag1">I love <span class="tag2">apple</span></span><span class="tag2"> pie</span>
When using tag1, I expect "I love apple" to be displayed in red font.
However, only "I love" appears in red font.
How can I correct this issue?
doc.getStyleSheet().addRule(".tag1 {color : red;}");
try {
kit.insertHTML(doc, doc.getLength(), "<span class=\"tag1\">I love <span class=\"tag2\">apple</span></span><span class=\"tag2\"> pie</span>", 0, 0, null);
} catch (IOException e1) {
e1.printStackTrace();
} catch (BadLocationException e1) {
e1.printStackTrace();
}