11-25-2013, 07:14 AM | #16 | |
Chief Bohemian Misfit
Posts: 571
Karma: 462964
Join Date: May 2013
Device: iPad, ADE
|
Quote:
I do seem to recall that in one of the threads I looked at the other day (while trying to find how to do this, before posting my question) had one person coming up with a possible solution, and another person replying by saying that what they'd done should be put in an SVG wrapper -- but if I remember correctly, that's where that thread ended and there was no explanation or expansion on that (I don't have a link for that thread, off-hand, but could probably find it again -- although as I said it didn't go into the reason "why" it should be in an SVG wrapper, let alone did that person explain how). Gotta run -- busy day today! And thanks again to Rubén for all your great input here! |
|
11-25-2013, 12:02 PM | #17 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Due to the way CSS works, using background-image does not mean the ePub will be invalid. It is still a perfectly valid and compliant ePub 2 file (as long as there's nothing else breaking it). It just means that just-as-compliant readers are free to ignore the background image and not display it. If that happens, you cannot blame the reader. Whether or not this possibility is enough to worry you, that depends on the nature of the background image and your nitpicking level
|
11-25-2013, 02:48 PM | #18 |
Fanatic
Posts: 580
Karma: 810184
Join Date: Sep 2010
Location: Norway
Device: prs-t1, tablet, Nook Simple, assorted kindles, iPad
|
I'm a great fan of SVG, but in this case, may it not work with a negative bottom margin? Something like:
Code:
<img src="prettypicture.jpg" style="width:100%;margin-bottom:-80%;" /> <h2 style="page-break-after:always;">Pretty pictures</h2> Or have somebody already suggested this? I had a little bit of trouble finding every one of the helpful links so far suggested in this thread. |
11-25-2013, 03:29 PM | #19 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
|
11-25-2013, 03:44 PM | #20 | |
Wizard
Posts: 1,542
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
https://www.mobileread.com/forums/sho...d.php?t=223178 and https://www.mobileread.com/forums/sho...d.php?t=226285 |
|
11-26-2013, 01:20 AM | #21 | |
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
|
Quote:
I didn't explain myself clearly - I meant that the image with superimposed text does the same job as a background image with text - although of course the text can't be made bigger or smaller. You have excellent taste in ebooks. |
|
11-26-2013, 10:58 AM | #22 | |
Chief Bohemian Misfit
Posts: 571
Karma: 462964
Join Date: May 2013
Device: iPad, ADE
|
Well, I'm frustrated -- again. I spent hours last night doing up all 20+ chapter title pages in that SVG method you posted, Rubén, and although they all look great now, I'm such a dummy that it was only after I'd spent all that time fixing up every chapter title so that it would look nice -- which is a total pain to do when you have to adjust everything with pixels rather than just specifying a heading or paragraph or whatever -- that it hit me that in the process I'd invariably lost all my <h1> tags (duh!) and hence none of the chapters were getting marked to the table of contents either.
If only for this latter reason (re the ToC) and, indeed, for the MUCH greater ease of editing, I thought I'd go try out your background-image method instead, and see what happens, i.e.... Quote:
In Sigil it looks fine -- and I haven't looked yet, but I'm guessing it probably would look fine in iBooks -- but in ADE it doesn't work at all. The image comes out HUGE (i.e. full-size), not constrained to the 900px height, let alone is it "contained". And my title text seems to get lost off to the side somewhere, "invisible". Any suggestions? What I had hoped to do isn't quite what you had done at the above link -- you basically had a lo-res image that sat at the top left corner of the page (or that's how it "looks", of course), but I wanted a full-page image, and then plop my chapter title text on that. If it's just not really doable or practical, well, I'll just scrap the idea -- but even if it works in some readers and then for others just shows the text but no background image at all (without "breaking" anything), I could live with that. |
|
11-26-2013, 11:35 AM | #23 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
>>If it's just not really doable or practical, well, I'll just scrap the idea -- but >>even if it works in some readers and then for others just shows the text but no >>background image at all (without "breaking" anything), I could live with that.
The only problem with that is which ones it breaks on, unless this is not a commercial job, just for your own use. It can be hard to test for all of them. |
11-26-2013, 02:10 PM | #24 | |
Chief Bohemian Misfit
Posts: 571
Karma: 462964
Join Date: May 2013
Device: iPad, ADE
|
Quote:
|
|
11-26-2013, 04:21 PM | #25 | ||
Wizard
Posts: 1,542
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
According to what I posted, indeed, there is not any <h1> tag so it can't appear in the TOC . Suppose you have something like that: Code:
<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> 1. First, in your stylesheet.css file, add this: Code:
h1 { display: none; } Code:
<h1 title="Whatever be the title you want here"> </h1> Code:
<h1 title="Whatever be the title you want here"> </h1> <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> Quote:
Could you post here the image you are using and the text you want to write over it? Maybe of that way I can say you more things about what to do. Regards Rubén |
||
11-27-2013, 02:58 AM | #26 |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Why do you need a <div>? Can't you just have the SVG code inside ah <h1>?
Code:
<h1 title="Chapter title"> <svg xmlns="http://www.w3.org/2000/svg" ...> ... </svg> </h1> |
11-27-2013, 05:13 AM | #27 |
Wizard
Posts: 1,542
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
That is because in theory, you can't enclose a svg wrapper inside <h>, <p> and some others tags. Sigil allows the use you propose but maybe some ereaders doesn't and Psymon is a "purist" and he want to use a svg wrapper instead of a background image because he fears that some devices doesn't show that image. For that reason I used a <div> container.
|
11-27-2013, 07:22 AM | #28 | |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
Now, if you'd said "in practice", meaning that some readers choke with that, I'd fine with it (I don't know if that's the case, though) (Anyway, this is something that only affects automatic TOC generation/update with Sigil. You can always create the NCX by hand and add whatever links and names you want, regardless of the HTML code.) |
|
11-27-2013, 11:01 AM | #29 | ||
Wizard
Posts: 1,542
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
element 'svg' is not allowed for content model '(p|h1|h2|h3|h4|h5|h6|div|ul|ol|dl|pre|hr|blockquote|address|fieldset|table|switch|form|noscript|ins|d el|script)' (The curious thing is that, in that list, also is included div ) Of course, the svg COULDN'T BE inside <blockquote> tags but it WORKS and also WORKS in ADE!!! (below I attach a working ePub with a svg enclosed in blockquotes tags; of course, it doesn't validate, but working). So, in order to avoid problems, I decided that the better thing was to enclose the svg inside a DIV. Quote:
|
||
11-27-2013, 11:15 AM | #30 | |
frumious Bandersnatch
Posts: 7,516
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
|
Quote:
But I think you misunderstand the message. The list is not giving all the elements where <svg> is forbidden, but all the elements that are allowed there: and "svg" (or "img") is not in the list, hence the error. The case with <p> or <hX> is entirely different. Those can have character-level children, and therefore <svg> or <img>. Do you get validation errors with <svg> inside <p> or <hX>? |
|
|
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 |