diff --git a/resources/compiled_coffeescript.zip b/resources/compiled_coffeescript.zip
index 542fa62662..ed1efb290d 100644
Binary files a/resources/compiled_coffeescript.zip and b/resources/compiled_coffeescript.zip differ
diff --git a/src/calibre/ebooks/oeb/display/paged.coffee b/src/calibre/ebooks/oeb/display/paged.coffee
index 909ac15ae9..d3a88183c5 100644
--- a/src/calibre/ebooks/oeb/display/paged.coffee
+++ b/src/calibre/ebooks/oeb/display/paged.coffee
@@ -140,6 +140,13 @@ class PagedDisplay
first_layout = true
if not single_screen and this.cols_per_screen > 1
num = this.cols_per_screen - 1
+ elems = document.querySelectorAll('body > *')
+ if elems.length == 1
+ # Workaround for the case when the content is wrapped in a
+ # 100% height
. This causes the generated page divs to
+ # not be in the correct location. See
+ # https://bugs.launchpad.net/bugs/1594657 for an example.
+ elems[0].style.height = 'auto'
while num > 0
num -= 1
create_page_div()
diff --git a/src/pyj/read_book/paged_mode.pyj b/src/pyj/read_book/paged_mode.pyj
index cc193d6530..50ba10bcc9 100644
--- a/src/pyj/read_book/paged_mode.pyj
+++ b/src/pyj/read_book/paged_mode.pyj
@@ -114,6 +114,13 @@ def layout(is_single_page):
first_layout = True
if not single_screen and opts.cols_per_screen > 1:
num = opts.cols_per_screen - 1
+ elems = document.querySelectorAll('body > *')
+ if elems.length == 1:
+ # Workaround for the case when the content is wrapped in a
+ # 100% height
. This causes the generated page divs to
+ # not be in the correct location, at least in WebKit. See
+ # https://bugs.launchpad.net/bugs/1594657 for an example.
+ elems[0].style.height = 'auto'
while num > 0:
num -= 1
create_page_div()