View Single Post
Old 08-31-2019, 01:01 AM   #37
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 46,471
Karma: 169113646
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by graycyn View Post
So I tried Turtle91's method for chapter number and title and it worked great! No troubles on ADE, iBooks or Kindle. Many thanks!

BUT, I ran the epub through Kepubify and loaded the kepub on my Kobo Aura One and it didn't work there.

What happened was the h2 styling was mostly ignored and the span honored. Both chunks of text displayed at 1.4em font size, bold and left-aligned. The look I was trying to achieve was with the chapter number RIGHT aligned (not bold) and the chapter title LEFT aligned (bold), mimicking the print book.

But in the kepub, I got both showing LEFT aligned and at the font size and weight set for the chapter title.

This is the CSS. It validated. So did the epub before Kepubifying it.

Spoiler:
Code:
{
font-size: .96em;
font-weight: normal;
font-style: normal;
text-align: right;
text-indent: 0;
margin-top: 18%;
margin-bottom: 15%;
}

h2 span
{
display: block;
font-size: 1.4em;
font-weight: bold;
text-align: left;
margin-top: 2em;
}


And the HTML:

Code:
<h2>CHAPTER 1<span>Chapter Title</span></h2>

The look in the kepub is readable, just not nice looking. I was able to make it work for kepub, by assigning spans and classes to both chapter number and title and styling accordingly, that solution works across the board, ADE, iBooks, Kindle, Kobo kepub, but it's NOT elegant.

So did I do anything wrong here that prevented it from working as kepub or is it a Kobo thing? Or possibly a Kepubify issue?
The only time I played with splitting lines left/right turned into a mess. I could get the lines aligned but I had fun trying to get the vertical alignment correct and finally gave up.

Code:
<div>
  <h2 class="leftie"><span class="biggun">Chapter Title</span></h2>
  <h2 class="rightie">Chapter 1</h2>
</div>
<div style="clear: both;"></div>

.leftie {
	float: left;
}
.rightie {
	float: right;
}
h2 {
font-size: 1em;
font-weight: normal;
font-style: normal;
margin-top: 2em;
margin-bottom: 2em;
}

.biggun {
font-size: 1.4em;
font-weight: bold;
}
Good luck...
DNSB is offline   Reply With Quote