View Single Post
Old 11-10-2017, 02:53 PM   #1
deback
Book E d i t o r
deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.deback ought to be getting tired of karma fortunes by now.
 
Posts: 432
Karma: 288184
Join Date: May 2015
Device: Laptop
Cover Images Aren't Always Being Centered

I just did a test (two separate conversions) of converting a file where the cover image was centered before the conversion and was not centered after the conversion.

The original code (created by Calibre at some time in the past when adding the cover image) for the cover image page was, as follows:

<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
<meta name="calibre:cover" content="true"/>
<title>Cover</title>
<style type="text/css" title="override_css">
@page {
padding: 0;
margin: 0;
}
body {
text-align: center;
padding: 0;
margin: 0;
}
div {
padding: 0;
margin: 0;
}
img {
padding: 0;
margin: 0;
}
</style>
</head>

<body>

<div>

<img src="cover.jpeg" alt="cover" style="height: 100%"/>

</div>

</body>

</html>


After the first conversion of the original file (with SVG unchecked and Preserve Cover Ratio checked), the cover image page and the CSS codes were:

<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
<meta name="calibre:cover" content="true"/>
<title>Cover</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css"/>
<link href="page_styles.css" rel="stylesheet" type="text/css"/>
</head>

<body class="calibre19">

<div class="calibre20">

<img src="cover.jpeg" alt="cover" class="calibre21"/>

</div>

</body>

</html>

.calibre20 {
display: block;
line-height: 1.2em;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
}
.calibre21 {
height: 100%;
line-height: 1.2em;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
width: auto;
}

(NOTE: There is no "text-align: center;" in calibre20 above.)


After the second conversion of the original file (with SVG checked), the cover image page and the CSS codes were:

<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
<meta name="calibre:cover" content="true"/>
<title>Cover</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css"/>
<link href="page_styles1.css" rel="stylesheet" type="text/css"/>
</head>

<body class="calibre19">

<div class="calibre20">

<img src="cover.jpeg" alt="cover" class="calibre21"/>

</div>

</body>

</html>

.calibre20 {
display: block;
line-height: 1.2em;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
}
.calibre21 {
height: 100%;
line-height: 1.2em;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
margin-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
padding-top: 0;
width: auto;
}

(NOTE: There is no "text-align: center;" in calibre20 above.)


I don't recall this happening until the last few weeks. I've been having to add "text-align: center;" much more often lately.
deback is offline   Reply With Quote