|
|
#1 |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 531
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
|
Inline-block element gets cut off and/or moved to a new screen
In the attached file, I have some blockquoted poetry that i want to be left aligned within its block, but the whole block to be centered within the page.
My approach is to inline-block the <blockquote>, and wrap it in a "text-align: center; display: block;" <div> container. Unfortunately, this is causing two very undesirable behaviors: 1) if the whole blockquote wouldn't fit in the remaining space on the page, the whole element gets pushed to the next page, rather than displaying as many lines as can fit on the first page, and then flowing the rest of the text to the second page. 2) if the whole blockquote is longer than the screen, it will just cutoff whatever text is more than fits on a single screen length. Anybody have any ideas as to howI can get the alignment behavior I'm looking for without all of these non-reflowing effects? |
|
|
|
|
|
#2 | |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 82,387
Karma: 151278869
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
1. That issue is fixed 2. I've fixed it so if the text does not fit on the screen, it will wrap to the next screen. There's no way to change this. I've dropped the <div> that you don't need or want. I've also changed the classes you use. Now if a line is too long for the screen, it will wrap with an indent to show it's part of the same line. Now you will see that the ePub looks good. |
|
|
|
|
|
|
#3 | |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 531
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
|
JSWolf, I appreciate your taking a stab at this, but:
1. the issue is not fixed. 2. the issue is not fixed. I do need and want that <div> (or at least something like it) otherwise the blockquote isn't centered on the page. It's the whole point of my previous post [emphasis added]: Quote:
|
|
|
|
|
|
|
#4 |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 531
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
|
I tried moving the inline-block property from the blockquote element to the p elements within it themselves, which does solve the issue of the blockquote element not reflowing, but creates a bunch of new issues:
1) for some reason the bottom margin of the blockquote isn't rendered (i.e. the blockquote lies on top of the <p> element with no margin) (NOTE: the attached image is NOT showing this behavior. It is attached to show the desired effect as described in the following bullet). 2) it prevents aligning items realtive to the width of the blockquote container. So, for example if I want an attribution line ("<p>Written by<br />A very clever guy</p>") that is left-aligned relative to itself, but the element is right-aligned relative to the broader blockquote AND bounded by the preceding poem rather than the page width (see image1 attached)... well, it doesn't work because the inline-block has been applied to the stanzas individually rather than the blockquote. So, unfortunately, I don't think inline-blocking the stanzas is the solution, either... |
|
|
|
|
|
#5 |
|
Zealot
![]() Posts: 103
Karma: 10
Join Date: Nov 2025
Device: none
|
I don't quite understand what kind of display you are looking for. Could you explain it clearer or draw some pic to help others understand?
I tested your file in Sigil, and change display from inline to bolck and it seems just like what you said? But I doubt it's just that simple. |
|
|
|
|
|
#6 |
|
Zealot
![]() Posts: 103
Karma: 10
Join Date: Nov 2025
Device: none
|
After some second thought, why do you need it's block to be centered? Every block defult took up 100% screen width. There is no room to wiggle.
|
|
|
|
|
|
#7 | |
|
Resident Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 82,387
Karma: 151278869
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Quote:
If you have it centered, what do you do if any of the lines don't fit in full? The way I did it when they wrap, you know it and it looks OK. If you have it centered, it will not look good when any of the lines wrap. You also have to have text wrap to the next screen when it doesn't fully fit on one screen. There is no other way to do it. So basically, what you want is unrealistic. |
|
|
|
|
|
|
#8 |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 531
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
|
I'm sorry if it's going to sound like i'm repeating myself, but I genuinely don't know how else to describe it:
as in the picture above (EDIT: and below), I want the stanzas of a poem in a blockquote to be left-aligned WITHIN the blockquote. But i want the blockquote to be center-aligned relative to the page. What you're seeing in the image above is what Sigil PageEdit (and similarly Sigil's Preview window) displays. HOWEVER, the way Sigil/PageEdit previews epub is not how they are actually rendered in most readers. So, for example if you try to view my original file in the ReadiumReader plugin, you will see both instances of the "errors/undesired formatting" that I described in the first post. As a corollary to this, I want the width of the blockquote to be defined by the text it contains so that if i right-align two lines of text (broken by a <br /> tag) the rightmost boundary will be defined by the longest line in the blockquote, not the rightmost bounds of the page itself. Last edited by ElMiko; Yesterday at 01:05 PM. |
|
|
|
|
|
#9 | |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 531
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
|
Quote:
When you say "what do you do when a line doesn't fit in full" I'm truly baffled by the question. The line breaks! Like normal reflowable text (See image2 attached). If the font size is bigger, then it breaks sooner. If the screen is smaller then it breaks sooner. And if the screen is wider or the text smaller then the line may not break at all, the text will be centered relative to the page but not its adjacent text (see image3 attached). When you say it won't look good, that's just, like, your opinion, man. My original question was not seeking aesthetic feedback; it was strictly technical. The images attached below "look good" to me; i just can't get it to render that way in actual ereading software. |
|
|
|
|
|
|
#10 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,786
Karma: 9501034
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
You had some competing margins in the blockquote.
A quick first try, can you try this css then tweak as necessary... Spoiler:
|
|
|
|
|
|
#11 |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 531
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
|
@Karellen: I didn't have competing margins at all. JSWolf had competing margins in his "fixed" version of my file, which bears little in common with mine and didn't attempt to address the initial issue. So I don't know that your working in that file is really all that worthwhile. From what i can tell, you cleaned up JSWolf's formatting, but it doesn't really speak to my underlying issue of centering a block of left aligned text within a given screen (or screens) because, well, JSWolf wasn't trying to address it in the first place.
FWIW, my little mock-up did have an error, but it's not making any difference in the rendering: much of the text was placed above the body tags... oops. Last edited by ElMiko; Yesterday at 01:34 PM. |
|
|
|
|
|
#12 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,786
Karma: 9501034
Join Date: Sep 2021
Location: Australia
Device: Kobo Libra 2
|
oops. I didn't scroll up far enough and grabbed the one from jswolf.
I'll take another look. |
|
|
|
|
|
#13 |
|
Zealot
![]() Posts: 103
Karma: 10
Join Date: Nov 2025
Device: none
|
|
|
|
|
|
|
#14 |
|
Zealot
![]() Posts: 103
Karma: 10
Join Date: Nov 2025
Device: none
|
Oh, I think I got it. Let me re-phrase it, tell me I'm right or wrong.
You want every sentence of poem to be displayed in their own line (as long as screen can fit), and the width of block will be determined by the longest sentence. And the longest sentence will be centered in the screen, and the rest sentences will left-align with the longest sentence. Is this right? |
|
|
|
|
|
#15 | |
|
Fanatic
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 531
Karma: 65460
Join Date: Jun 2011
Device: Kindle Voyage, Boox Go 7
|
Quote:
(Honestly, it's kind of satisfying just hearing it stated using different words; i was stressing out that i couldn't even conceive of another way to describe it!) |
|
|
|
|
![]() |
|
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 |