![]() |
#1 |
Connoisseur
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 80
Karma: 2137678
Join Date: Dec 2021
Location: Canada
Device: none
|
Page breaks & keeping paragraphs together
Hey folks. Still using Sigil. Enjoying the improvements.
![]() My question is this: I'm putting out an epub version of a book I published before. It is a book of questions, and each questions has a topic heading. In other words, there's a title followed by a paragraph of text, usually 2 lines or less. Sort of question1: I want to make 3 or four questions per page. I guess I'll have to split the pages, right? Serious question2: Can I keep titles (H3) together with <p> the next paragraph? I can't seem to find any css code for that or any decent instructions. So easy in print layout, so mysterious in css. Anyone doing this? I may have more questions, but this is good for now. Thanks in advance. |
![]() |
![]() |
![]() |
#2 |
Well trained by Cats
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 30,883
Karma: 59840450
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
|
<h3 does not cause a page break by default. So...
Code:
<div class="together"> <h3 class="foo">Topic</h3> <p class="descript">bar1</p> <p class="descript">bar2</p> <p class="descript">bar3</p> </div> Code:
.together { Display:block; page-break-inside:avoid; } ![]() |
![]() |
![]() |
Advert | |
|
![]() |
#3 | ||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
Otherwise, you have to rely on:
Your ebook can then make suggestions to the device—"please break here"—but most devices don't support (or will ignore) that CSS code. - - - Side Note: For more detailed info, see my responses and code examples in:
In those threads, I also went into extreme detail on lyrics/poetry, where you sometimes want these things kept together as entire chunks. (I believe one of those users had a book full of poems, so wanted each poem starting on its own screen.) - - - Quote:
When I deal with poems + figures/captions, I follow the best practices I described in the links above, then cross my fingers and hope better devices/readers come out in the future. ![]() Last edited by Tex2002ans; 02-26-2023 at 08:41 PM. |
||
![]() |
![]() |
![]() |
#4 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,633
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
![]() Suppose you have the following code: Code:
<h3>This is a title</h3> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac tellus nunc. Phasellus imperdiet leo metus, et gravida lacus. Donec metus ligula, elementum at pellentesque pellentesque, suscipit ac nunc.</p> Code:
<p class="joined"><span class="subh3">This is a title</span>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac tellus nunc. Phasellus imperdiet leo metus, et gravida lacus. Donec metus ligula, elementum at pellentesque pellentesque, suscipit ac nunc.</p> Code:
.joined { orphans: 3 /* use 4 if you want three lines of text after the <h>tag */ text-indent: 0; } .subh3 { display: inline-block; width: 100%; font-size: 1.2em; /* change the size here according to your wishes */ font-weight: bold; text-align: center; /* change the alignment if you want */ text-indent: 0em; padding: 1em 0; /* change the value here if you want */ } EDIT: Of course, not all ereaders have one of the last versions of webkit. So old ereaders devices based on webkit won't be able to avoid the fragmentation. Last edited by RbnJrg; 02-26-2023 at 11:45 PM. |
|
![]() |
![]() |
![]() |
#5 | |
A Hairy Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 3,295
Karma: 20171067
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:
Code:
div.keeptogetherprettyplease {break-inside:avoid} <div class="keeptogetherprettyplease"> <h3>The First Question</h3> <p class="Question">WHAT is your name?</p> <p class="Answer">Sir Robin of Camelot.</p> </div> <div class="keeptogetherprettyplease"> <h3>The Second Question</h3> <p class="Question">WHAT is your quest?</p> <p class="Answer">To seek the Holy Grail.</p> </div> <div class="keeptogetherprettyplease"> <h3>The Third Question</h3> <p class="Question">WHAT is the capital of Assyria?</p> <p class="Answer">I don’t know that.......Auuuuuuuugh.</p> </div> ![]() No matter what we would like, the user may not see more than a few words per screen (seriously... my wife has the font sooo large and the spacing so big, she only sees a few words per 'page' on her iPhone 14 Pro Max.) So all that headache you are putting yourself through to get it just right really is only worth it in a print format....not a reflowable electronic one. Cheers! edit: ooops...ninja'd by RbnJrg. I would completely trust his advice if you are using ePub2. But I think widows/orphans have been deprecated in ePub3, so you may need to check that if you are using ePub3. Last edited by Turtle91; 02-26-2023 at 11:13 PM. |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,633
Karma: 8566337
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Code:
.joined { display: inline-block; width: 100%; } Code:
.joined { display: block; page-break-inside: avoid; break-inside: avoid; } |
|
![]() |
![]() |
![]() |
Tags |
keep paragraphs together |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Google Play Books & Page Breaks | Rand Brittain | ePub | 12 | 05-15-2015 01:33 PM |
PRS-T1 Long paragraphs cause unwanted page breaks on PRS-T1 | entodoays | Sony Reader | 2 | 03-11-2014 06:21 AM |
Conversion issue - page breaks on paragraphs | Anonymouslemming | Conversion | 2 | 11-06-2013 11:45 AM |
how to get page breaks before and after images (using epubs In & Out) | lhgrappler | Calibre | 9 | 10-06-2010 11:57 AM |
Book Designer Sounds & Page Breaks | pitolee | Sony Reader | 6 | 04-15-2007 05:46 AM |