Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 12-20-2012, 10:25 PM   #16
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
Quote:
Originally Posted by Jellby View Post
Again, that 100% means 100% of the container's height, and the container (probably <body>) has no fixed height, but rather is as high as needed to fit its contents. As humans, we assume it means "100% of the screen height", but that's not what the spec says, and that's not what all renderers interpret (though it might be what some do).

Set it to "height: 10cm", or similar, instead, and it should work as expected (but not as wanted).

This, of course, unless I'm mistaken due to ignorance or misunderstanding of the specs
You're right. What I said wasn't quite complete. You'll also need to set sizes for the body and html tags and clear out their margins/padding.

It might also be worth using min-height instead of height just in case A. your content ends up on a device that doesn't support SVG, B. your fallback content is used, and C. it is taller than a screenful.


In other words:

Code:
<html style="min-height: 100%; width: 100%; padding: 0; margin: 0; border-width: 0;">
<body style="min-height: 100%; width: 100%; padding: 0; margin: 0;border-width: 0;">
<div style="min-height: 100%; width: 100%; padding: 0; margin: 0; border-width: 0;">
<object data="..." preserveAspectRatio="..." viewBox="0 0 100% 100%">
Optional non-SVG fallback HTML or image here
</object>
</div>
</body>
</html>
Because the outer html tag has no containing element, per section 10.1 of the CSS 2.1 spec (#1 in the numbered list), a width or min-height value of 100% causes it to fill the viewport (if it isn't already larger than the viewport) or the page, depending on whether you're talking about the web or paged media. In the case of an EPUB reader, I'd expect that distinction to be moot.

In an ideal world, we would all just use the new CSS3 viewport-relative lengths (vw and vh), but I suspect it will be many years before you can count on that unit being supported broadly enough to be useful.
dgatwood is offline   Reply With Quote
Old 12-21-2012, 06:17 AM   #17
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,515
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Specifying 100% for html and below could work according with the spec, but I wouldn't trust readers to comply. On the other hand, it's only a solution if a file contains an image and nothing else (like a cover page), it's no good for mid-text illustrations.
Jellby is offline   Reply With Quote
Advert
Old 12-21-2012, 06:46 AM   #18
Toxaris
Wizard
Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.Toxaris ought to be getting tired of karma fortunes by now.
 
Toxaris's Avatar
 
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
Some readers will actually give strange results if you set the <html> and/or <body> to 100%. For example in some cases the PRS-T1 will not advance to another page unless specifically the page number is entered.
Toxaris is offline   Reply With Quote
Old 12-21-2012, 11:45 AM   #19
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
Quote:
Originally Posted by Toxaris View Post
Some readers will actually give strange results if you set the <html> and/or <body> to 100%. For example in some cases the PRS-T1 will not advance to another page unless specifically the page number is entered.
As I said, you should probably use min-height, not height. By my reading of the thread from a few months ago, the bug in question involved setting height to 100%. IIRC, the spec is a little ambiguous about how height should be handled if your content exceeds a single screen height worth of content, which I'm assuming those test cases that triggered this bug probably did. And I could see how a reader could get confused (though it's still a bug) if that happens.

If it fails in this way with min-height: 100% and a single-page SVG image, however, then the reader is broken (and this seems much more unlikely). The specification is unambiguous about how that should be handled, and if you find that it does not work on the Sony reader, please file bug reports with Sony. They really need to fix that bug, as designs that include full-page-size images (for things like title pages) are likely to become more and more common as time passes, not less.

Last edited by dgatwood; 12-21-2012 at 11:50 AM.
dgatwood is offline   Reply With Quote
Old 12-28-2012, 04:46 PM   #20
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
Quote:
Originally Posted by dgatwood View Post
As I said, you should probably use min-height, not height. By my reading of the thread from a few months ago, the bug in question involved setting height to 100%. IIRC, the spec is a little ambiguous about how height should be handled if your content exceeds a single screen height worth of content, which I'm assuming those test cases that triggered this bug probably did. And I could see how a reader could get confused (though it's still a bug) if that happens.

If it fails in this way with min-height: 100% and a single-page SVG image, however, then the reader is broken (and this seems much more unlikely). The specification is unambiguous about how that should be handled, and if you find that it does not work on the Sony reader, please file bug reports with Sony. They really need to fix that bug, as designs that include full-page-size images (for things like title pages) are likely to become more and more common as time passes, not less.
Actually, I'm going to have to correct that statement. You must use min-height only on the innermost div or whatever.

Because of a rather severe ambiguity in the CSS specification (Thanks, W3C), some browsers treat the parent element's height as zero if it is constrained only by a min-height. I consider that interpretation to be incorrect, but it's a popular interpretation, exhibited by both WebKit and Firefox. *sigh*
dgatwood is offline   Reply With Quote
Advert
Old 12-28-2012, 07:37 PM   #21
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
-----
Deleting erroneous reply.

Last edited by dgatwood; 12-28-2012 at 07:40 PM.
dgatwood is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[kindle touch] zoom image? zerolucat Kindle Developer's Corner 4 10-31-2012 02:58 PM
Zoom in/out image victorhugoa ePub 3 12-15-2011 04:40 AM
Image Zoom Kittel68 Amazon Kindle 3 06-28-2011 02:17 PM
Workaround for lack of capitals in ADE ozaru ePub 11 09-02-2010 08:59 PM


All times are GMT -4. The time now is 12:57 AM.


MobileRead.com is a privately owned, operated and funded community.