Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 03-14-2026, 05:47 PM   #31
Horus01
Junior Member
Horus01 will become famous soon enoughHorus01 will become famous soon enoughHorus01 will become famous soon enoughHorus01 will become famous soon enoughHorus01 will become famous soon enoughHorus01 will become famous soon enough
 
Posts: 3
Karma: 530
Join Date: May 2012
Device: Kindle Voyage
I use this code for poems; it doesn't work in ADE, but it does in Kindle. It functions similarly to the code with `width: fit-content`.

Code:
blockquote.poem {
    display: table;
    margin: 1em auto;
    padding: 0 1em;
  }
Horus01 is offline   Reply With Quote
Old 03-14-2026, 07:04 PM   #32
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 537
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
Quote:
Originally Posted by icearch View Post
To my test, margin left and right are definitely necessary. Otherwise it would snap to left. And to be sure, you need to do another blank div to enclose all of that, for good measure.
Yes, I agree that the auto L/R margins are necessary. My question was about the center class, though. I haven't observed any difference with it or without it, but that doesn't mean there isn't one...

Last edited by ElMiko; Yesterday at 07:40 AM.
ElMiko is offline   Reply With Quote
Old 03-14-2026, 07:10 PM   #33
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 537
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
Quote:
Originally Posted by Horus01 View Post
I use this code for poems; it doesn't work in ADE, but it does in Kindle. It functions similarly to the code with `width: fit-content`.

Code:
blockquote.poem {
    display: table;
    margin: 1em auto;
    padding: 0 1em;
  }
Hmmm interesting. I might want to take a little from column a and a little from column b. I take it the L/R padding is to set fixed values rather than the % Max width in RbnJrg's solution.
ElMiko is offline   Reply With Quote
Old 03-14-2026, 08:14 PM   #34
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: 82,418
Karma: 151278869
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 ElMiko View Post
Hmmm interesting. I might want to take a little from column a and a little from column b. I take it the L/R padding is to set fixed values rather than the % Max width in RbnJrg's solution.
If this could possibly be read on a nook or Kobo, do not use that CSS code.

P.S. The CSS code does work in ADE/RMSDK

Last edited by JSWolf; Yesterday at 06:36 AM.
JSWolf is offline   Reply With Quote
Old 03-14-2026, 08:54 PM   #35
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,465
Karma: 20550481
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 this could possibly be read on a nook or Kobo, do not use that CSS code.
Are you saying that the Nook and Kobo can’t handle tables either?!??! That sounds like they are pretty useless, and don’t meet standards. It’s time to move on…
Turtle91 is offline   Reply With Quote
Old 03-14-2026, 09:26 PM   #36
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 537
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
Quote:
Originally Posted by JSWolf View Post
If this could possibly be read on a nook or Kobo, do not use that CSS code.
Why not? What exactly will happen if I use RbnJrg's or Horus01 code?
ElMiko is offline   Reply With Quote
Old Yesterday, 06:17 AM   #37
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: 82,418
Karma: 151278869
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
Are you saying that the Nook and Kobo can’t handle tables either?!??! That sounds like they are pretty useless, and don’t meet standards. It’s time to move on…
Yes, the older RMSDK can handle tables. But it was said that the CSS code posted does not work in ADE.

I had a search through ePubs I've read and some do have display: table; in the CSS and they works no problem. I do not see anything in the CSS that @Horus01 posted that does not work in ADE/RMSDK.

Last edited by JSWolf; Yesterday at 06:36 AM.
JSWolf is offline   Reply With Quote
Old Yesterday, 06:37 AM   #38
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: 82,418
Karma: 151278869
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 ElMiko View Post
Why not? What exactly will happen if I use RbnJrg's or Horus01 code?
@Horus01 is incorrect. The CSS code he posted does work in ADE/RMSDK. So if you do want to use it, there's no reason not to.
JSWolf is offline   Reply With Quote
Old Yesterday, 07:25 AM   #39
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 537
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
Quote:
Originally Posted by JSWolf View Post
@Horus01 is incorrect. The CSS code he posted does work in ADE/RMSDK. So if you do want to use it, there's no reason not to.
Horus01 is correct. You are mistaken.

The code does not work in ADE 2.X. In fact, it gets REALLY funky. The "auto-centering" fails, but it also then duplicates all the text and displays each line as a separate cell in a row. And the top and bottom margins fail. (Also, with my modified "inline-block" attribution, this doesn't get aligned right, either). See imageADE-H attached.

RbnJrg's code also fails to "auto-center", applying the 85% max-width constraint right-to-left rather than 7.5% on either side. It also ignores the "fit-content" property. See imageADE-RJ attached.

And in my modified code, which steals a bit from RbnJrg and a bit from Horus01, the auto-center effect fails (although in this particular case it gives the illusion of centering because of the right-aligned attribution), as does the "fit-content" property. See imageADE-EM attached.

Spoiler:
Code:
blockquote.bqibEM {
    margin: 1em auto;
    padding: 0 2em;
    display: block;
    width: fit-content; 
	}


However, in both RbnJrg's and my FrankenCode, it doesn't produce any MAJOR readability issues that I can discern. It just doesn't look as nice as it would in an application that isn't total trash.

So, in summary:
1) The only code that you endorsed (other than your own, which didn't address any of the concerns in the original post) has serious readability issues in ADE, which Horus01 rightly pointed out from the jump.
2) The apparent readability of RbnJrg's and my new code (courtesy of RbnJrg's and Horus01's tips & tricks) means that your constant refrain that we use code optimized for ADE 2.X is basically taking the position that ebooks should look mediocre across all platforms rather than looking good in several and mediocre only in ADE. I can comfortably say: this is a weird take.
3) Thank you again to RbnJrg and Horus01 for their help. Teamwork apparently does make the dream work.

EDIT: P.S. in my code snip above, I'm defining the L/R boundaries in em units because I want the max-width to be relative to paragraph indents (which i usually set at 1.5em) rather than the width of the screen. However, if I used % units to define paragraph indents (e.g. "text-indent: 5%;") I think one could basically acheive the same result as RbnJrg's original code by using "padding: 0 7.5%;" instead of the max-width property... I think. I'll let RbnJrg confirm or clarify this, though.
Attached Thumbnails
Click image for larger version

Name:	imageADE-H.jpg
Views:	7
Size:	279.1 KB
ID:	221778   Click image for larger version

Name:	imageADE-RJ.jpg
Views:	7
Size:	327.6 KB
ID:	221779   Click image for larger version

Name:	imageADE-EM.jpg
Views:	7
Size:	331.2 KB
ID:	221780  

Last edited by ElMiko; Yesterday at 09:05 AM.
ElMiko is offline   Reply With Quote
Old Yesterday, 12:36 PM   #40
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,919
Karma: 9553607
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by ElMiko View Post
Quick question (hopefully): do you know why when using your classes if I do <div class="center"><div class="block"> the bottom margin disappears when the text has to flow onto a second page (see image4 attached)?
The bottom margin disappears because with my code, the margin is set to the unique and main div (<div class="center block">), so that element has a bottom margin of 1em. But when you use:

Code:
<div class="center"> /* Here there is no margin at all */
   <div class="block"> /* Here I suppose you have a bottom margin */
...
...
   </div> /* After that, a bottom margin of 1em */
</div> /* After that, no bottom margin */
So if all the code is in the same page, the margin of .block works, but whe the code is splitted to the next page, the bottom margin is absorbed (according to your method). Use padding instead of margin if you want to use two <div>

Quote:
Also, I tested it with class="center block" and class="block center" and it appears to be agnostic to order. Is that right?
In this case, yes, is right.

Quote:
EDIT: Re: ADE, of course not. What else is new? But also we're already on 4.5.something... when can we collectively forget about that trash application? Surely, those old nooks and kobos are on their last legs battery-wise....
The code works on ADE 4.5, but you need to employ the epub3 protocol in your epub.
RbnJrg is offline   Reply With Quote
Old Yesterday, 12:39 PM   #41
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,919
Karma: 9553607
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by ElMiko View Post
@RbnJrg — Follow-up question: Is the "center" necessary or are the left and right auto margins sufficient to center the block?
No, it's not necessary; the property "text-align: center" was a legacy of your original code.
RbnJrg is offline   Reply With Quote
Old Yesterday, 12:58 PM   #42
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,919
Karma: 9553607
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by ElMiko View Post
I take it the L/R padding is to set fixed values rather than the % Max width in RbnJrg's solution.
You want a center block with text aligned to left. If you, instead of "width: fit-content" and "max-width: 85%" (or whatever) employ L/R padding, if your stanzas are short, then all of them won't be centered, you'll have a lot of blank space on the right side. With my code, the width is automatic (fit-content) and the block will be centered acording to the longest stanza.
RbnJrg is offline   Reply With Quote
Old Yesterday, 08:26 PM   #43
ElMiko
Fanatic
ElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileReadElMiko has read every ebook posted at MobileRead
 
ElMiko's Avatar
 
Posts: 537
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
Quote:
Originally Posted by RbnJrg View Post
You want a center block with text aligned to left. If you, instead of "width: fit-content" and "max-width: 85%" (or whatever) employ L/R padding, if your stanzas are short, then all of them won't be centered, you'll have a lot of blank space on the right side. With my code, the width is automatic (fit-content) and the block will be centered acording to the longest stanza.
hmmm... I think maybe either I wasn't clear or I'm just not understanding your explanation.

what i'm referring to is my code that blends your css and Horus like this:

Code:
div.bqib {
    margin: 1em auto;
    padding: 0 2em;
    display: block;
    width: fit-content; 
	}
In otherwords, the only difference is that instead of using max-width to create L/R boundaries, I'm using padding.

I've attached two images below. One uses your max-width + fit-content approach, and the other uses your fit-content + Horus01's padding. In all other respects they are the same.

For blocks where all the lines are short, it appears to center everything exactly the same in both cases... It's just the the "borders" of the block are basically being defined in your code from the inside-out and in the other case from the outside-in.
Attached Thumbnails
Click image for larger version

Name:	imageRJmaxwidth.jpg
Views:	2
Size:	297.4 KB
ID:	221820   Click image for larger version

Name:	imageEMpad.jpg
Views:	2
Size:	295.2 KB
ID:	221821  
ElMiko is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Inline-block and float interaction ElMiko ePub 15 08-27-2025 04:01 AM
Inline-block eggheadbooks1 Sigil 3 10-31-2016 03:07 AM
Creating epub with inline block problem Gerlyn ePub 5 12-22-2011 01:59 PM
Does mobi support display: inline-block; DeniseL Kindle Formats 2 09-30-2011 07:33 PM


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


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