Fix small cover images not being vertically centered

This commit is contained in:
Kovid Goyal 2019-09-19 18:29:24 +05:30
parent 1e57c4180e
commit 4e6353468b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 2 deletions

View File

@ -487,7 +487,7 @@ def set_epub_cover(container, cover_path, report, options=None):
if wrapped_image is not None: if wrapped_image is not None:
# The cover page is a simple wrapper around a single cover image, # The cover page is a simple wrapper around a single cover image,
# we can remove it safely. # we can remove it safely.
log('Existing cover page is a simple wrapper, removing it') log('Existing cover page {} is a simple wrapper, removing it'.format(cover_page))
container.remove_item(cover_page) container.remove_item(cover_page)
if wrapped_image != existing_image: if wrapped_image != existing_image:
container.remove_item(wrapped_image) container.remove_item(wrapped_image)

View File

@ -263,7 +263,9 @@ class Container(ContainerBase):
img { img {
width: auto; height: auto; width: auto; height: auto;
margin-left: auto; margin-right: auto; margin-left: auto; margin-right: auto;
max-width: 100vw; max-height: 100vh max-width: 100vw; max-height: 100vh;
top: 50vh; transform: translateY(-50%%);
position: relative;
} }
</style></head><body><img src="%s"/></body></html> </style></head><body><img src="%s"/></body></html>
''' '''