Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 03-07-2015, 03:36 AM   #1
indieauthor83
Enthusiast
indieauthor83 began at the beginning.
 
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
indieauthor83 is offline   Reply With Quote
Old 03-07-2015, 04:15 AM   #2
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
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.
dgatwood is offline   Reply With Quote
Advert
Old 03-07-2015, 07:46 AM   #3
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,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.
RbnJrg is offline   Reply With Quote
Old 03-07-2015, 01:52 PM   #4
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
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:
Originally Posted by indieauthor83 View Post
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
Zoe:

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
Hitch is offline   Reply With Quote
Old 03-07-2015, 06:23 PM   #5
indieauthor83
Enthusiast
indieauthor83 began at the beginning.
 
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.
indieauthor83 is offline   Reply With Quote
Advert
Old 03-08-2015, 01:53 AM   #6
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
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)
Quote:
Originally Posted by Hitch View Post
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
Just ebook editor, it doesn't discriminate.

(It handles multiple formats -- EPUB and AZW3, and DOCX or HTML as input only.)
eschwartz is offline   Reply With Quote
Old 03-09-2015, 02:58 AM   #7
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
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:
Originally Posted by indieauthor83 View Post
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.
This is where I "hang with my peeps," basically. It's like a moderately quasi-secret pub for geeky ebook-makers. I haven't been in since last (Saturday) evening, but I'll look at the file first thing in the morning.

Hitch
Hitch is offline   Reply With Quote
Old 03-09-2015, 06:20 AM   #8
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,519
Karma: 987654
Join Date: Dec 2012
Device: Kindle
Quote:
Originally Posted by indieauthor83 View Post
Hi,


<img src="meonbeach.jpg" border="0" height="433" width="247"/>
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).
Notjohn is offline   Reply With Quote
Old 03-09-2015, 10:26 AM   #9
AThirstyMind
A Thirsty Mind
AThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with othersAThirstyMind plays well with others
 
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.
AThirstyMind is offline   Reply With Quote
Old 03-09-2015, 02:10 PM   #10
Hitch
Bookmaker & Cat Slave
Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.Hitch ought to be getting tired of karma fortunes by now.
 
Hitch's Avatar
 
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:
Originally Posted by AThirstyMind View Post
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.
Thirsty:

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
Hitch is offline   Reply With Quote
Old 03-11-2015, 07:34 AM   #11
Notjohn
mostly an observer
Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.Notjohn ought to be getting tired of karma fortunes by now.
 
Posts: 1,519
Karma: 987654
Join Date: Dec 2012
Device: Kindle
Quote:
Originally Posted by AThirstyMind View Post
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.
Hitch (who knows much more about all this than I do) doesn't like this solution, but I use percentages, most often width="100%" but sometimes smaller, as in width="12%" for a title page publisher's colophon, or even width="60%" for an image that if enlarged to the max would look sub-standard. Be aware that the early-model Kindles will ignore such instructions (not a problem with the 100% solution, since all images in those devices are shown full screen unless very tiny) and so will the iPad and perhaps iPhone running the Kindle app.

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.
Notjohn is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 07:59 PM.


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