On some epub devices, you can change the background color to black, with the font switching to white. My iBook program allows four distinct styles.

Is there a way to override these styles for particular elements? For example, I'm converting a book that's in the public domain to an epub. I'm adding a few notes, which I style (red text) to indicate those notes were written by me, not the original author.

But if I switch to dark mode, my styles are lost. If I insert a style directly into my text, like this...

<span style="color: #f00;">Make me yellow!</span>

...even that is overriden.

Is there a special CSS style that can override these custom backgrounds, or are the backgrounds controlled by JavaScript or some other programming language?

P.S. There is at least one workaround of sorts. Device styles don't appear to affect border colors. If I style a paragraph with a red border, for example, then the border remains red when I preview my epub. I haven't tested it in all devices, however.

1 Answer 1


Every device works in a different way, I don't think that there are standards regarding the programming of the software that they are equipped with.

Besides that, almost every e-reading device and software allow some form of user customization over the display of the text, and AFAIK, you can't prevent this by coding inside the ebook. If you use styles that serve some functional purpose and not just for aesthetics (like your example, to differentiate between different kind of notes), your best option is to add a disclaimer on the first pages stating that if the user chooses to apply his customization, the intended experience/functionality can be compromised.

Usually the ereader, to know how to display the text, looks for these things in this order:

  1. User customization of the ereader
  2. Styles as defined in the CSS inside the ebook
  3. The default ereader settings

Furthermore, keep in mind that often ebooks are read on B&W eink devices that can't display colored text.

If you need to differentiate between, i.e., author's notes and editor's notes, I would use some kind of abbreviation like A.N. and E.N, or a different font style setting (i.e. normal and italic, a different font), and with a disclaimer like said before.

  • Good tips. I just came up with another idea as well: I can insert tiny images (e.g. a question mark with a yellow background) in each of my notes. That way, they will be distinctive, and the images won't compromise the viewer's choice of display.
    – WordBear
    Feb 1, 2017 at 23:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.