11-23-2014, 07:58 AM | #1 |
Fanatic
Posts: 580
Karma: 810184
Join Date: Sep 2010
Location: Norway
Device: prs-t1, tablet, Nook Simple, assorted kindles, iPad
|
KF8 relative image dimensions problem
In my stylesheet file, if I write something like this:
Code:
img { width:76%; height:auto; } This happens both on the previewer and on actual devices. Have I missed something? And is there a better workaround than using @media device-width/height and setting an absolute width? |
11-24-2014, 06:57 AM | #2 | |
Wizard
Posts: 1,542
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Code:
div.image1 { width: 80%; } img { width: 100%; height: auto; } Code:
<div class="image1"> <img alt="" src="../Images/MyImage.png" /> </div> Regards Rubén |
|
11-24-2014, 08:13 AM | #3 |
Fanatic
Posts: 580
Karma: 810184
Join Date: Sep 2010
Location: Norway
Device: prs-t1, tablet, Nook Simple, assorted kindles, iPad
|
Thanks for the suggestion, Rubén, I hadn't thought about testing that one. Sadly, that doesn't work either. The book in question is Wisting, Oscar: 16 år med Roald Amundsen, by the way.
The 76% width limit does make it natural to think of the e-ink aspect ratio, but what kind of warped logic that dictates that 77%-100% == 100% I cannot begin to fathom. KF8 has been a bitter disappointment to me; I thought it would be an improvement to Epub2, but there are so many spurious limitations, inconsistencies and apparent bugs that it falls greatly behind. Maybe there should be a stickie in this forum with "KF8 annoyances", similar to the "ADE bugs" stickie in the epub forum? |
11-24-2014, 12:11 PM | #4 | |
Wizard
Posts: 1,542
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Code:
<div class="ic"> <img alt="-*-" src="../Images/image00089.jpeg" /> <div class="caption"></div> </div> * For portrait images: Code:
div.ic { page-break-inside: avoid; text-align: center; margin: 1em 0; } div.ic img { width: 80%; margin-left: 10%; } Code:
div.ic { page-break-inside: avoid; text-align: center; margin: 1em 0; border: 1px solid red; } div.ic img { width: 80%; margin-left: 10%; border: 1px solid blue; } Code:
div.ic img { width: 80%; margin: 0 auto; } Code:
@media (device-height:1024px),(device-height:800px),(device-height:1440px) Regards EDIT: Also -in this case- you can supress left/right margin for images. Just use: Code:
div.ic img { width: 80%; margin: 0; } Last edited by RbnJrg; 11-24-2014 at 12:25 PM. |
|
11-24-2014, 12:44 PM | #5 |
Fanatic
Posts: 580
Karma: 810184
Join Date: Sep 2010
Location: Norway
Device: prs-t1, tablet, Nook Simple, assorted kindles, iPad
|
Thanks for taking the trouble of looking at the code. I should have made clear that the CSS as it stands does the job, the images are both centered and are limited in height so as to give room for a caption underneath on eink-kindles, while they are full-width on fire-kindles. So the @media tag works as it stands, at least.
Anyway, I've discovered that for for CSS purposes, screen dimensions are 600px*800px for both standard kindles and paperwhite, never mind that the physical resolution of paperwhite is more. Does anybody now if this holds true also for the Voyager? If so, the relative width issue resolves itself, because I can always assume a 600x800 screen for eink-kindles. BTW, is this documented somewhere, preferably by Amazon? Or do I risk that their next e-ink device has a different CSS-wise resolution? |
11-24-2014, 01:34 PM | #6 | |
Grand Sorcerer
Posts: 11,470
Karma: 13095790
Join Date: Aug 2007
Location: Grass Valley, CA
Device: EB 1150, EZ Reader, Literati, iPad 2 & Air 2, iPhone 7
|
Quote:
See also http://www.w3.org/TR/css3-values/#reference-pixel Dale Last edited by DaleDe; 11-24-2014 at 01:37 PM. |
|
11-25-2014, 03:48 AM | #7 |
Fanatic
Posts: 580
Karma: 810184
Join Date: Sep 2010
Location: Norway
Device: prs-t1, tablet, Nook Simple, assorted kindles, iPad
|
Thanks, DaleDe. The reference pixel was a new one for me. After a little cogitation, I see that it makes some sense – border lines etc. that are commonly given width in pixels will show uniformly across devices. And now I can have some confidence that all 6" e-ink kindles will have 600x800 reference pixels.
I'll check if the Fire also deals with reference pixels ASAP. I still don't get why the eink kindles cannot deal with percentage dimensions in a sane manner, though. Somewhat related, in this book (very soon to be updated with corrections), I struggled with full-height, floating images, admittedly with ragged edges. Depending on font size, the first line on the next page was completely or partly cut off vertically. The workaround I've used is to reduce the vertical height to 96% (or thereabouts), and add a blank image, full-width and height 40px or thereabouts to ensure that if anything is cut off, it'll be the blank strip. |
Tags |
image aspect ratio |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
What should the dimensions of an ebook cover image be? | ecbritz | Sigil | 18 | 09-07-2013 03:11 AM |
problem with floating image and relative width | jobalcaen | ePub | 5 | 08-17-2013 07:53 AM |
Best Image Dimensions for Fire | x2far | Kindle Formats | 3 | 04-25-2013 07:38 PM |
Image dimensions for Kindle Fire | x2far | Workshop | 1 | 02-08-2012 06:39 PM |
Image dimensions | eBookNoir | Barnes & Noble NOOK | 2 | 02-14-2011 03:22 PM |