View Single Post
Old 06-15-2018, 03:35 PM   #7
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,797
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by Corinne View Post
Hi Reuben. I hope I attached the above file correctly. It is what I see when I go into edit book. I tried your code yesterday and it didn't work, no doubt because I entered it incorrectly. I have no other books in Calibre save for the one I'm currently working on, above.

I enlarged the cover drawing by a few kb's yesterday and it centered itself automatically, and unexpectedly, in both epub and mobi. They both present beautifully...
Well, I don't know where to start for

The first thing: the screenshot you attached it says me that you are using a svg wrapper. And inside of that svg wrapper, you are putting a .jpeg image (I didn't see any text inside the container). So, your cover consists only in one image, no text. But the way to center an image (or text) inside a svg wrapper is different from the way we employ when we're not in a svg container. And what I explained you in my previous posts, is to center image or text, out of a svg wrapper.

The second thing: according to your screenshot, you are already applying styles by means of "embedded css" (if you want to understand better the way to apply styles, watch the link below).

https://en.wikibooks.org/wiki/Cascad...HTML_and_XHTML

And, in your embedding styles, you have the following (do click in the picture to enlarge it):

Click image for larger version

Name:	Image1.png
Views:	371
Size:	49.6 KB
ID:	164480

The style body {text-align: center; padding: 0pt; margin: 0pt;} what it makes, is to center all text and images inside the .xhtml file. So, you already have set that all elements in the files with the embedded style body {text-align: center; padding: 0pt; margin: 0pt;} are centered. For that reason is that you see all centered automatically.

Third thing: in your svg wrapper, you are using the property preserveAspectRatio="none". Very probably it would be better for you to set that property as "xMidYMid meet", that is, preserveAspectRatio="xMidYMid meet". If you want to understand better what that means, look at this link:

https://wiki.mobileread.com/wiki/SVG...26_AspectRatio

Also it would be very good for you to read all that page, if you are going to use svg covers.

Quote:
...but will I still need to center them anyway in edit books?
No, you won't. The elements are already centered by the embedded styles you are applying (of course, in the "Code View" pane of Calibre you won't see them centered, only in the "File preview" pane.

Quote:
In epub, the drawings are justified left with a simple poem on the right. Once I convert to mobi, from epub, they all center themselves automatically! I'm wondering if they will stay that way?
Yes, they will

Quote:
I thank you for your helpful guidance and will study it so I can learn it.
You are welcome
Rubén
RbnJrg is offline   Reply With Quote