11-24-2013, 12:19 AM | #1 |
Chief Bohemian Misfit
Posts: 571
Karma: 462964
Join Date: May 2013
Device: iPad, ADE
|
Background image with text on top?
I have a perfect use in a new book I'm working on for having each chapter begin with a nice, big heading/chapter title on a single page and -- if at all possible -- a background image on that page. I know how to do this and have it work in iBooks, but it doesn't seem to work in ADE. I've just spent the last two or three hours scouring countless messages in these forums (and elsewhere on the 'net) and I can't seem to find any consensus on a solution that will work across-the-board.
Is there a way? I just want to throw in a single page here and there with a full-page background image, and put the chapter title on top of that -- I'm starting to think that there's simply no reliable way to do it in epub and would probably be better off just scrapping the whole idea. Hopefully someone can tell me I'm wrong, and there is a way? |
11-24-2013, 01:17 AM | #2 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Altough you can define a background image in the stylesheet, how will you ensure that it will be a full-page image?
|
11-24-2013, 01:34 AM | #3 | |
Chief Bohemian Misfit
Posts: 571
Karma: 462964
Join Date: May 2013
Device: iPad, ADE
|
Well, I have this ebook called "eBook Typography", by Chris Jennings -- which, surprisingly, doesn't validate and is chock full of zillions of errors -- and in there he has all his chapter headings with a background image which work just great in iBooks... but which don't show up at all in ADE.
The way he says to do it, though (but which only works in iBooks) is as follows, quoted directly from his book: Quote:
|
|
11-24-2013, 03:04 AM | #4 |
frumious Bandersnatch
Posts: 7,515
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
background-image (or -position, -repeat, -size) is not in the required set of CSS properties for ePub 2.
|
11-24-2013, 05:49 AM | #5 | |
Grand Sorcerer
Posts: 5,583
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
|
Quote:
@Psymon: Have a look a the Custom Chapterhead style --- possible in CSS? topic for an interesting way to style headings without background images. |
|
11-24-2013, 05:54 AM | #6 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Jellby is correct, it is only background-color is supported. I will put the book of Chris Jennings on my blacklist. What use is such a book when it does not validate or does not specifically mentions that things only specific devices/programs?
|
11-24-2013, 07:53 AM | #7 | ||
Chief Bohemian Misfit
Posts: 571
Karma: 462964
Join Date: May 2013
Device: iPad, ADE
|
Two replies here...
Quote:
Appreciate the suggestion, though. Quote:
I did find another thread here... https://www.mobileread.com/forums/sho...d.php?t=215430 ...which seemed to have an alternative solution that doesn't used background-image. Right near the end (second-last reply at this time) he seems to have come up with a way of doing it that doesn't "look" quite the way I want, but I wonder if it can be tweaked so that it does. Hmm... I'll play around with that code over my morning coffee, and if I can come up with something I'll post it here (and if you don't hear back from me again then either it didn't work, or else it worked but I had a heart attack and suddenly died). |
||
11-24-2013, 08:42 AM | #8 | |
Wizard
Posts: 1,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Please, could you post a screenshoot of your iBooks so I can see better what you want in ADE? By the way, did you see this post: https://www.mobileread.com/forums/sho...87&postcount=5 That solution also works in ADE. Regards Rubén |
|
11-24-2013, 09:19 AM | #9 | ||
Chief Bohemian Misfit
Posts: 571
Karma: 462964
Join Date: May 2013
Device: iPad, ADE
|
Quote:
Quote:
That's interesting, as I've tried the epub there out in both iBooks and ADE, and indeed it seems to work just fine in both -- although looking at the code it's apparently making use of a background image (which supposedly should not work, or at least not be supported). I'm not sure what to do. I want to do it "right", and then this example you gave here seems to work, and yet it's "wrong" (even though it validates, once I add the title/language in). I just spent the last little while trying to put together something that I hoped would work based on what the guy did in that previous link I provided (here's the link again to save you scrolling/searching for it)... https://www.mobileread.com/forums/sho...d.php?t=215430 I created the attached file based on that -- pretty much guessing my way through the CSS and adapting it into what I want to do. If you look at the code in Sigil, you won't see the background image in the preview, BUT if you look at it in ADE, the background shows up, with the title text (etc.) overlaying like it's supposed to, and it's almost exactly how I'd like it to be except for the fact that I'm not sure how to get the image to resize itself to fit within the window and no bigger. And, I don't know how to get it to work in iBooks (which it doesn't). I'm by no means an "expert" at CSS, though -- I wonder if perhaps this might have provided some inspiration for someone else to come up with a workable solution? It'd be so cool if I could get this to work right, without using background-image (even though RbnJrg seems to have no provided a solution that seems to work that way!). in advance! |
||
11-24-2013, 11:05 AM | #10 | ||||
Wizard
Posts: 1,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Quote:
Quote:
Quote:
|
||||
11-24-2013, 12:14 PM | #11 |
Wizard
Posts: 1,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Well, this is a "new" way of doing the things without using a background image. In this case Psymon, you'll have to use a SVG container. In your .html file write the following:
Code:
<body> <div> <svg xmlns="http://www.w3.org/2000/svg" height="100%" preserveAspectRatio="xMidYMid meet" version="1.1" viewBox="0 0 533 800" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink"> <image height="800" width="533" xlink:href="../Images/bamboo_fence.jpg"></image> <text fill="red" style="font-size: 50px" text-anchor="middle" x="266.5" y="200"> This Here <tspan x="266.5" y="280">Is A</tspan> <tspan x="266.5" y="370">Chapter Title</tspan> </text> <image height="63" width="63" x="235" xlink:href="../Images/ornament.png" y="450"></image> <text fill="green" style="font-size: 30px; font-style: italic" text-anchor="middle" x="266.5" y="600">By Author</text> </svg> </div> </body> This is a screenshot of Sigil: This is a screenshot of Kindle Previewer: I don't know how it looks in iPad since I don't have one Below you can see my ePub. One more thing: I changed the resolution of your "bamboo_fence" image to 800 x 533 px; take in count that. Of course, you can put the text in any place of the svg container; what I did is just an example. Regards Rubén PS: I still think is better to use a background image. PS2: WITH THIS WAY OF DOING THE THINGS, YOU MUST ALWAYS WORK WITH PIXELS, OTHERWISE YOU'LL HAVE TROUBLES IN ADE. Last edited by RbnJrg; 11-24-2013 at 12:26 PM. |
11-24-2013, 03:50 PM | #12 | |
Chief Bohemian Misfit
Posts: 571
Karma: 462964
Join Date: May 2013
Device: iPad, ADE
|
First, to RbnJrg, I haven't taken the code you wrote and plopped it into my ebook to try it out, but I definitely take your word for it that it works, and can't thank you enough for that! This truly will be awesome if it all does work out, and the only thing that really mystifies me is that this never seemed to come up before, that nobody else ever wanted to do this before -- at least, after all that searching yesterday, I couldn't find an answer to this (which you now seem to have provided for me).
Thanks so much again! But before I respond a little more to your message, the only thing that concerns me about this is what Jellby wrote (and which Toxaris reiterated, too)... Quote:
Back to your reply, RbnJrg... I just tried it out, and it comes out perfectly! Of course, for different lengthed titles I'm going to have to make some adjustments here and there (re font sizes or whatever), but I guess I'll figure that out -- pending any replies from others giving a drastic reason that I shouldn't do it this way (which I'm keeping my fingers crossed won't happen!). Code:
One more thing: I changed the resolution of your "bamboo_fence" image to 800 x 533 px; take in count that. Code:
Of course, you can put the text in any place of the svg container; what I did is just an example. Code:
PS: I still think is better to use a background image. Code:
PS2: WITH THIS WAY OF DOING THE THINGS, YOU MUST ALWAYS WORK WITH PIXELS, OTHERWISE YOU'LL HAVE TROUBLES IN ADE.
Thanks so much again, RbnJrg! I can't wait to try this out in my book for all the chapters (20+ of them), although unfortunately I have company coming over now, and over the next two days I'm helping my mom move -- so it might have to wait until later this week. Hopefully I'll be able to sneak in some "me" time, though, and I do look forward to any more comments on this subject (from you or others). Cheers! |
|
11-24-2013, 04:27 PM | #13 | ||||||||
Wizard
Posts: 1,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
||||||||
11-25-2013, 12:54 AM | #14 |
Wizard
Posts: 3,413
Karma: 13369310
Join Date: May 2008
Location: Launceston, Tasmania
Device: Sony PRS T3, Kobo Glo, Kindle Touch, iPad, Samsung SB 2 tablet
|
I'm sorry, I'm probably going to expose my ignorance or lack of sophistication here, but I don't understand your question. I have uploaded several ebooks in which I took an image to use as the cover, and then overwrote the book title on that image. One of them is
Saladin and the Conquest of Jerusalem by Stanley Lane-Poole, in the ePub section at https://www.mobileread.com/forums/sho...d.php?t=224264 The cover is from a painting by Gustave Doré, and I think could qualify as background image. The html and CSS are certainly nothing fancy. Could this method not be used for an internal chapter? I presume you'll be starting the chapter on a new page. |
11-25-2013, 06:03 AM | #15 | |
Wizard
Posts: 1,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Certainly you can use an image as a background and write above, that is the easiest method and the one I recommend. The solution that I developed by using a SVG wrapper I did it because Psymon didn't want to use a background image. As for the book you mention, I was watching it and I didn't find a cover with a background image and text on top, maybe you did that in another book and not in the one you mention. But anyway, it is perfectly possible to use a background image and write text on it. That is what I did in: https://www.mobileread.com/forums/sho...87&postcount=5 By the way, very very nice layout of the book you posted; I really like it a lot. You have made a great work with it; congratulations. Regards Rubén |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kindle paperwhite crop background-image on top/bottom | j.puff@ppp.eu | Kindle Formats | 2 | 08-28-2013 11:58 AM |
Kindle paperwhite crop background-image on top/bottom | j.puff@ppp.eu | Kindle Developer's Corner | 1 | 08-26-2013 06:02 PM |
iBooks: Text overflowing image if it's at top of screen. | Oxford-eBooks | ePub | 30 | 05-10-2013 12:56 AM |
Image overlayed over text (but text visible if image disabled)? | Kaylee Skylyn | ePub | 5 | 08-01-2012 05:27 PM |
Background image | djrulz | Kindle Formats | 1 | 03-29-2011 04:51 PM |