diff --git a/src/pyj/read_book/settings.pyj b/src/pyj/read_book/settings.pyj index d4004b0e37..5b4f064d1b 100644 --- a/src/pyj/read_book/settings.pyj +++ b/src/pyj/read_book/settings.pyj @@ -38,12 +38,13 @@ def apply_colors(): def apply_stylesheet(): - sid = 'calibre-browser-viewer-user-stylesheet' - style = document.getElementById(sid) - if not style: - style = E.style(type='text/css', id=sid) - document.body.appendChild(style) - style.textContent = opts.user_stylesheet or '' + if opts.user_stylesheet: + sid = 'calibre-browser-viewer-user-stylesheet' + style = document.getElementById(sid) + if not style: + style = E.style(type='text/css', id=sid) + document.documentElement.appendChild(style) + style.textContent = opts.user_stylesheet def apply_settings():