02-03-2017, 09:05 PM | #1 |
Banned
Posts: 244
Karma: 2112680
Join Date: Jan 2017
Device: iBooks
|
Widowed (Orphaned?) Header
I'm working on an epub in Sigil. I have a chapter that has brief information for each of the 50 states. Each section begins with a state's name in a h4 tag.
When I preview my book, I sometimes see a header resting on the bottom of a page, with the following paragraph on the next page. I tried wrapping the header and following paragraph in a div, like this... <div class="Widow"> <h4 class="State" id="me">Maine</h4> <p>This is a paragraph.</p> </div> Then applying this style: div.Widow { widows: 3; } I also changed widows: 3 to orphans: 3, just to make sure I didn't have it backwards. But it doesn't work. Can anyone suggest another strategy for gluing a paragraph to a header, so the header doesn't wind up all alone on the preceding page? Thanks. |
02-03-2017, 09:28 PM | #2 |
A Hairy Wizard
Posts: 3,095
Karma: 18727053
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
|
You can try the "page-break-inside:avoid" style in your div or "page-break-before:always" in your h4 styling. Unfortunately, there's no guarantee that all readers/apps/devices will honor that.
The only way to guarantee that a header will be at the top of a page is to make it the first part of a new html page. |
Advert | |
|
02-03-2017, 09:32 PM | #3 |
Banned
Posts: 244
Karma: 2112680
Join Date: Jan 2017
Device: iBooks
|
I'll give that a try, but I don't want these headers to be at the top of the page. Rather, they're part of the flow and can appear anywhere. I just want to make sure that they're "glued" to the first paragraph following the header. If the paragraph is on the next page, then I'd like the header to be on that page, too.
I'll give your suggestions a try. Thanks. To clarify, each chapter's header is wrapped in h2 tags. Subheadings (if any) are wrapped in h3 tags. The state headers are in h3 tags. Some of the state descriptions are as short as a single paragraph, so there could be three state headers on one page. |
02-03-2017, 09:37 PM | #4 |
Grand Sorcerer
Posts: 6,497
Karma: 84420419
Join Date: Nov 2011
Location: Tampa Bay, Florida
Device: Kindles
|
You can use "page-break-inside: avoid", but it isn't universally supported.
(Ninja'd) |
02-03-2017, 09:45 PM | #5 |
Banned
Posts: 244
Karma: 2112680
Join Date: Jan 2017
Device: iBooks
|
Ah, page-break-inside: avoid works great. Thanks for the tip.
|
Advert | |
|
02-04-2017, 05:38 AM | #6 | |
Wizard
Posts: 1,543
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Quote:
Code:
h4 { page-break-after: avoid; } Regards Rubén |
|
02-04-2017, 06:01 AM | #7 |
mostly an observer
Posts: 1,515
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
Not what you want to hear, I suppose, but I think anyone who has read more than one or two e-books will not be put off by seeing a breakhead at the bottom of a "page."
Will these h4 headings actually be in the TOC? If not, shouldn't you use a paragraph style? |
02-05-2017, 12:25 PM | #8 | |
Banned
Posts: 244
Karma: 2112680
Join Date: Jan 2017
Device: iBooks
|
Quote:
Good tip about the paragraph style; I'm used to using headers on my web pages, but I guess turning me headers into paragraphs would automatically avoid this problem. And if I do decide to keep my headers, I stumbled across another CSS style that might work: display: inline-block Any idea if it's universally supported? I have a hunch it should be more popular. |
|
02-07-2017, 01:05 PM | #9 | ||||
Wizard
Posts: 2,297
Karma: 12126329
Join Date: Jul 2012
Device: Kobo Forma, Nook
|
Quote:
Quote:
Quote:
Quote:
You even posted in one of the latest times this was brought up! https://www.mobileread.com/forums/sh...21#post3403721 Last edited by Tex2002ans; 02-07-2017 at 01:07 PM. |
||||
02-07-2017, 08:31 PM | #10 | |
Banned
Posts: 244
Karma: 2112680
Join Date: Jan 2017
Device: iBooks
|
Quote:
I haven't had a chance to check out iBooks Author yet, but I hope it doesn't have those same problems. |
|
02-11-2017, 06:24 PM | #11 | |
Bookmaker & Cat Slave
Posts: 11,462
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
If the H4 elements are structural--in other words, if you were using an outline, and these would indicate a class of element, below h3, then they should remain headings. But if they are not--if they are used solely for stylistic purposes--they should be demoted to paragraphs. I believe, Tex, that that is what all three of us--you, me and NJ--meant. Hitch |
|
02-12-2017, 12:12 AM | #12 | |
Banned
Posts: 244
Karma: 2112680
Join Date: Jan 2017
Device: iBooks
|
Quote:
The master TOC - or whatever you call the TOC that consists of regular pages - is another story. There I can go into greater detail. |
|
Tags |
header, orphan, widow |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Orphaned apps on iOS6 | tomsem | Apple Devices | 25 | 10-20-2014 10:45 PM |
Orphaned Edit Metadata window | theducks | Library Management | 2 | 05-21-2014 04:41 PM |
Delete Orphaned Files on Device | Geremia | Devices | 8 | 08-24-2013 12:49 PM |
Orphaned end double quotes | AlexBell | Workshop | 2 | 09-07-2011 07:33 AM |
Orphaned Works legislation | nekokami | News | 12 | 04-29-2008 10:51 AM |