Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 03-25-2025, 06:57 PM   #1
jwes
Connoisseur
jwes began at the beginning.
 
Posts: 69
Karma: 10
Join Date: Jul 2023
Device: none
Units and dimensions

When should I use which units for dimensions, e.g. should fonts be pt, em, px, in, ... ? What about margins or images?
jwes is offline   Reply With Quote
Old 03-25-2025, 08:24 PM   #2
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,329
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
This question has been addressed many times. You should be able to find multiple responses if you search the MR forum.

In general, use em for fonts/margins/indents so they are resizable by the user and maintain relative size with other items on the page... However, many advocate not specifying any size (in any dimension) for those at rely on the user setting. I think it depends on the device used by your target market, and prefer to set a default size that the user can then override if they desire. I highly advise against using any fixed size units (pt, px, in, etc.) as that looks absolutely horrible on anything except the device you are using when coding the ePub... eg if the user has a different size display or they use a different font size, etc.

I also tend to use % (or vh & vw) when defining image sizes or trying to limit an element based on the screen size or Viewing Height/Width.


Cheers,

Last edited by Turtle91; 03-25-2025 at 08:26 PM.
Turtle91 is offline   Reply With Quote
Advert
Old 03-25-2025, 09:13 PM   #3
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,415
Karma: 145491800
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
If you need the eBook to be ePub2 compatible, do not use vh or vw as they are not ePub2 compatible.
JSWolf is offline   Reply With Quote
Old 03-25-2025, 10:21 PM   #4
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,329
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Quote:
Originally Posted by JSWolf View Post
If you need the eBook to be ePub2 compatible, do not use vh or vw as they are not ePub2 compatible.
Every time you say something like this it proves you don’t pay attention to anyone’s posts.

Your statement is not true.

You simply need to use fallback coding.

Code:
CSS:
img {
  width:90%;
  width:90vw;
}
If your device app supports vw it will use it. If it doesn’t support it, it ignores it (as required by ePub spec) and “falls back” to the previous coding:90%

This is how CSS works, Jon. Please stop intentionally telling people things you know are incorrect.
Turtle91 is offline   Reply With Quote
Old 03-25-2025, 11:40 PM   #5
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 45,338
Karma: 168808725
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
But what if your renderer is so borked that it does not ignore unsupported CSS?

Sorry but couldn't help myself. :
DNSB is offline   Reply With Quote
Advert
Old 03-26-2025, 02:11 AM   #6
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,329
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Quote:
Originally Posted by DNSB View Post
But what if your renderer is so borked that it does not ignore unsupported CSS?

Sorry but couldn't help myself. :
lol

Well, the current method (and reason we see 2 css files on many ePubs…thanks ADE) is to put the newer coding on a different style sheet…. If the device is so borked that it ignores the entire sheet then it still falls back to the older coding on the other sheet!

Users of those borked devices should get a refund for false advertising, as they are NOT meeting the ePub standard! Lol

To be fair to ADE they realized they screwed up and fixed that problem in their newer version… but they should update the software on those outdated, “borked”, devices.

Last edited by Turtle91; 03-26-2025 at 02:20 AM.
Turtle91 is offline   Reply With Quote
Old 03-26-2025, 05:46 AM   #7
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,415
Karma: 145491800
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by DNSB View Post
But what if your renderer is so borked that it does not ignore unsupported CSS?

Sorry but couldn't help myself. :
That's the problem with the code for Standard Ebooks. They have CSS code (that's not needed at all) that RMSDK on a Kobo does not like and it throws out all of the CSS. If I'm not mistaken, it's a media query (don't know if it's one or more).

Your comment does make a sense.
JSWolf is offline   Reply With Quote
Old 03-26-2025, 05:48 AM   #8
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,415
Karma: 145491800
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Turtle91 View Post
lol

Well, the current method (and reason we see 2 css files on many ePubs…thanks ADE) is to put the newer coding on a different style sheet…. If the device is so borked that it ignores the entire sheet then it still falls back to the older coding on the other sheet!

Users of those borked devices should get a refund for false advertising, as they are NOT meeting the ePub standard! Lol

To be fair to ADE they realized they screwed up and fixed that problem in their newer version… but they should update the software on those outdated, “borked”, devices.
I highly doubt we'll ever get Kobo to update RMSDK. So we most likey are always going to have to code for the old version.
JSWolf is offline   Reply With Quote
Old 03-26-2025, 07:30 AM   #9
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,329
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Quote:
Originally Posted by JSWolf View Post
I highly doubt we'll ever get Kobo to update RMSDK. So we most likey are always going to have to code for the old version.
Yes....so use fall-back coding.....

Don't just give up and tell people it can't be done.....
Turtle91 is offline   Reply With Quote
Old 03-26-2025, 02:13 PM   #10
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,939
Karma: 60358908
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Turtle91 View Post
Yes....so use fall-back coding.....

Don't just give up and tell people it can't be done.....
I think you are ignoring:
Fallback encoding is INVALID, thus tossing the WHOLE CSS on some devices.
I know this to be true on my old EZReader 100% or none
theducks is offline   Reply With Quote
Old 03-26-2025, 05:14 PM   #11
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,329
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Not ignoring, just not giving examples to cover every situation. The simple example I gave shows the concept of using css properties and techniques to code for different devices. There are other techniques, such as the multiple css sheets to cover for ADE’s non-compliant issues, or devices that gag on a particular sheet. Other techniques that have been addressed on other threads discuss using techniques like @media queries or @supports queries or even JavaScript to link the appropriate css file at runtime based on the capabilities of the device.

There are ways to overcome most of these issues. However, as DNSB mentioned, if your device is soooo borked up that it can barely turn itself on, let alone meet the ePub2 specification, then there really isn’t a need to code for them anymore. Keeping coders from using the current spec because someone, somewhere, might have a Frankenstein device that can’t run it is not logical.

Besides, my biggest point here is keeping the MR readers from giving up on finding a solution just because Jon doesn’t think anything exists beyond ePub2… there are solutions to 98.9% of these issues…

Last edited by Turtle91; 03-26-2025 at 05:16 PM.
Turtle91 is offline   Reply With Quote
Old 03-27-2025, 09:48 AM   #12
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,666
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by theducks View Post
I think you are ignoring:
Fallback encoding is INVALID, thus tossing the WHOLE CSS on some devices.
I know this to be true on my old EZReader 100% or none
No, you didn't understand what Turtle91 wanted to say; in fact, the technique described by him is the best to deal with the ADE bug for epub2 ebooks. You need to employ TWO stylesheets; one of them is ONLY for ADE properties, the other one is for properties supported for Webkit/Readium ereaders. When ADE finds one property in the stylesheet for Webkit/Readium that doesn't like it, it will fully ignore THAT stylesheet BUT NOT ALL STYLESHEETS; the .css with ADE properties still will be honored by ADE. Watch the epub I attach and the .css I include; try opening it in ADE 2.x and in any other ereader not based on RMSDK; you'll understand better what I want to explain
Attached Files
File Type: epub ADE CSS Test.epub (2.4 KB, 52 views)
RbnJrg is offline   Reply With Quote
Old 04-03-2025, 02:31 PM   #13
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,415
Karma: 145491800
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by Turtle91 View Post
Every time you say something like this it proves you don’t pay attention to anyone’s posts.

Your statement is not true.

You simply need to use fallback coding.

Code:
CSS:
img {
  width:90%;
  width:90vw;
}
If your device app supports vw it will use it. If it doesn’t support it, it ignores it (as required by ePub spec) and “falls back” to the previous coding:90%

This is how CSS works, Jon. Please stop intentionally telling people things you know are incorrect.
Your fallback code does not work with the older RMSDK. The second width: is what's used and because ADE doesn't do vw, the wide: is ignored. Do you have a fallback that works? Given that % works, why use vw?

Last edited by JSWolf; 04-03-2025 at 02:43 PM.
JSWolf is offline   Reply With Quote
Old 04-03-2025, 07:35 PM   #14
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,329
Karma: 20171571
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Read the thread.
Turtle91 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Sage Total Dimensions jerryleejr Kobo Reader 3 03-20-2022 12:59 AM
Image dimensions eBookNoir Barnes & Noble NOOK 2 02-14-2011 03:22 PM
PRS-300 Actual Screen Dimensions jagfan Sony Reader 1 02-07-2010 02:09 PM
Thumbnail Dimensions? Halk Bookeen 2 11-29-2009 12:32 PM
dimensions? fishcube Sony Reader 1 10-15-2007 12:32 AM


All times are GMT -4. The time now is 08:16 AM.


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