![]() |
#1 |
Enthusiast
![]() Posts: 30
Karma: 10
Join Date: Feb 2015
Location: UK
Device: kindle fire hd
|
Problems with headers can anyone help?
Hi,
I've created a mobi file that I'm really happy with it, but I'm having trouble with my headers. Here's my html code: <div style="page-break-after:always"> <p align="center"> <a name="whatisconfidence"> <img src="meonbeach.jpg" border="0" height="433" width="247"/></a></p></div> <p><h2>What is confidence?</h2> Just to point out, I only added the 'page-break-after:always' because the image was appearing on a seperate page. But it still hasn't made a difference. ![]() I basically want the above image to appear on the same page as the H2 header. But by default the H2 header starts at the top of the screen on a seperate page. So my image that I want to appear at the top of the screen before the header, now is alone on it's own page, looking out of place. Can anyone help me with this? Thanks in advance Zoe |
![]() |
![]() |
![]() |
#2 |
Curmudgeon
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
|
That should be page-break-after: avoid. A div with PBA: always would force a page break after the div and before the h2, which would mean the h2 tag (which is outside the div) would always be on the top of a separate page. Bear in mind that most readers ignore page-break-after: avoid, however, so if you really want to force them into one page whenever possible, you'd probably need to wrap a div around the img and h2 tags and use page-break-inside: avoid, which at least some readers support.
Also, heading tags are block-level tags, and are not allowed inside a paragraph. Move it outside. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,762
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
One question: before the image (and in the same page), is there text? Or you only want the image and the caption are in the same page but no matter the text that is before and after of that image and caption? I ask you this because the height of your image is quite big (433 px) and is difficult that the picture (and its caption) remain in the same page if there must be text before them. In the second case (image and caption on the same page regardless of the previous and back text) is easy to get what you want; in the first case the solution is not very difficult but I'm afraid that won't work on older Kindle models (those who don't support the .kf8 format) but I'll wait your answer before writing a possible solution.
Last edited by RbnJrg; 03-07-2015 at 09:27 AM. |
![]() |
![]() |
![]() |
#4 | |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
You are thinking about it backwards. Do it like this: <div> (lose the page-break after here, it's wrong) <h2> <img src="meonbeach.jpg" border="0" height="433" width="247"/></h2></div> <h2>What is confidence?</h2></div> And then simply don't display the first h2. That's all there is to it. Create an appropriate class for the image. You don't need the div, actually, but...and why is the link there? Is that for your HTML TOC? If it is, put the link to the html PAGE, not the heading. If you have everything in one big long file (I think I recall that's the case, is that right?), then give the h2 heading that encases the image an id, and link to that, e.g., "chap12" or whatever it is. Does that make sense to you? YOU're using the Calibre ePUB or HTML editor (I don't use that, myself, so I don't know which terminology is right). Hitch |
|
![]() |
![]() |
![]() |
#5 |
Enthusiast
![]() Posts: 30
Karma: 10
Join Date: Feb 2015
Location: UK
Device: kindle fire hd
|
Thanks for this reply!
I didn't realise you were on here. I ran my file through the w3org validator earlier and it brought up errors. So I have given it up as a bad-job for now. My little boy needs my full attention. So I'm going to leave it to the professionals! If I wasn't a full-time mum, with a house to run and work to do, I would be enjoying learning coding. I've learnt a lot, but I realise there's so much more to learn, and I don't have the time unforunately. I've sent the file to you, if you get chance to look at it. Thanks Zoe. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Ex-Helpdesk Junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
|
|
![]() |
![]() |
![]() |
#7 | |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
Hitch |
|
![]() |
![]() |
![]() |
#8 |
mostly an observer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,519
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
Be aware that if you use absolute sizes for an image, it will display very differently on different devices (basically, large on the older e-ink Kindles and small on the newer hi-rez tablets).
|
![]() |
![]() |
![]() |
#9 |
A Thirsty Mind
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 92
Karma: 2546
Join Date: May 2011
Location: Lubec, Maine
Device: Kindle Fire, iPad, iPhone
|
Notjohn, what should the line of code say? <img src= ?> so that I don't use absolute size? I haven't been satisfied with the size displayed on the newer devices now that you mention it.
|
![]() |
![]() |
![]() |
#10 | |
Bookmaker & Cat Slave
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 11,503
Karma: 158448243
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, NookColor. 2 Droid, Oasis, Boox Note2
|
Quote:
Be aware that there is no good "one size fits all" solution. The HD devices will display the image pixel-for-pixel, if the size is not set. If you set the size, as shown previously, again, it will display pixel-for-pixel at the stated size, which would be dreadfully small on, say, a Fire HD or an HDX. If you set a percentage, then you'll run into problems with the older Kindles, which will simply blow the image up to "as large as possible," as the older devices only ever contemplated a full-page cover. At my shop we use media queries; we display an image at size x for the KF7's, and we display it with percentages for KF8's. It's the only way to work around the problem, if you're trying to get it exactly right on all devices. Hitch |
|
![]() |
![]() |
![]() |
#11 | |
mostly an observer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,519
Karma: 987654
Join Date: Dec 2012
Device: Kindle
|
Quote:
And of course I now upload larger images, generally 800 pixels wide by whatever height is appropriate. Others use 1000 pixels. This is not a perfect solution across all platforms and devices, but it's "good enough for government work," as we used to say in the defense industry. Hitch doesn't work for the Pentagon, so of course she has higher standards. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
running headers | Run2Eat | Workshop | 3 | 06-07-2013 10:57 AM |
Running headers | AlexBell | ePub | 5 | 11-20-2011 03:41 AM |
Possible Page Headers? | eumesmo | Calibre | 3 | 12-15-2008 12:43 PM |
Cut off Headers | barney111 | Bookeen | 9 | 07-25-2008 04:15 AM |