Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 08-21-2019, 02:02 AM   #1
lumpynose
Wizard
lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.
 
Posts: 1,086
Karma: 4583858
Join Date: Jul 2012
Device: Palm Pilot M105
horizontally center table in mobi7?

I'm using the following css which works for epub but when I look at the dual mobi (converted with kindlegen) in the Mobipocket Reader the tables are at the left.

PHP Code:
table {
    
margin-leftauto;
    
margin-rightauto;
    
border-collapsecollapse;
    
margin-top1em;

I tried changing the html from just table to table align="center" but that didn't help and as I expected it then failed with epubcheck.
lumpynose is offline   Reply With Quote
Old 08-22-2019, 07:56 AM   #2
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,066
Karma: 3778603
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by lumpynose View Post
I'm using the following css which works for epub but when I look at the dual mobi (converted with kindlegen) in the Mobipocket Reader the tables are at the left.

PHP Code:
table {
    
margin-leftauto;
    
margin-rightauto;
    
border-collapsecollapse;
    
margin-top1em;

I tried changing the html from just table to table align="center" but that didn't help and as I expected it then failed with epubcheck.
You can't use "margin-left: auto" and "margin-right: auto". Instead, you must enclose the table between <blockquote> tags. For example:

Code:
table.YourTable {
     margin-top: 1em;
     border-collapse: collapse;
}

blockquote.MyTable {
     text-align: center;
}
and the .xhtml code would be something like:

Code:
<blockquote class="MyTable">
  <table class="YourTable" border="1">
    <thead>
      <tr>
        <th>First column</th>

        <th>Second Column</th>
      </tr>
    </thead>

    <tbody>
      <tr>
        <td>Some text here</td>

        <td>And more text here too</td>
      </tr>

      <tr>
        <td>This for ending</td>

        <td>And this too</td>
      </tr>
    </tbody>
  </table>
</blockquote>
IIRC, that could work for mobi7. If that doesn't work, then your best bet is to use a (.gif) image instead of the table. The mobi7 format is very limited and there are not many things you can do with it and with tables, less yet.


EDIT: Also you could try to enclose the table inside a <div> block. For example:

Code:
<div class="MyTable>
    <table>
      ...
      ...
    </table>
</div>
with

Code:
div.MyTable {
   text-align: center;
}
but now I don't remember why it was preferable to use <blockquote> tags (all this, of course, is for mobi7; for .kf8 and .KFX things are tottally different).

Last edited by RbnJrg; 08-22-2019 at 08:55 AM.
RbnJrg is online now   Reply With Quote
Old 08-22-2019, 11:13 AM   #3
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: 7,831
Karma: 76070063
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, and NookColor. 2 Droid, 1 Win8 ePUB rdrs
Quote:
Originally Posted by lumpynose View Post
I'm using the following css which works for epub but when I look at the dual mobi (converted with kindlegen) in the Mobipocket Reader the tables are at the left.

PHP Code:
table {
    
margin-leftauto;
    
margin-rightauto;
    
border-collapsecollapse;
    
margin-top1em;

I tried changing the html from just table to table align="center" but that didn't help and as I expected it then failed with epubcheck.
KF7 has no CSS whatsoever. You need to do whatever you want to do, in HTML only, inline.

If memory serves, using embedded blockquotes or even a single blockquote will indent it, but not center it. You can't put a table inside a paragraph, so...try centering a div and putting the table inside that. Yes, never mind, I see that Ruben already suggested that.

Hitch
Hitch is offline   Reply With Quote
Old 08-22-2019, 02:35 PM   #4
lumpynose
Wizard
lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.
 
Posts: 1,086
Karma: 4583858
Join Date: Jul 2012
Device: Palm Pilot M105
Ah, ok; thanks guys. I'll have to think about how ugly I want to make my html in order to make the mobi output nice.

Is there a way to have conditional html? For example, in my css I have the following; is there anything equivalent for html?

PHP Code:
@media amzn-mobi {
...

lumpynose is offline   Reply With Quote
Old 08-22-2019, 03:23 PM   #5
lumpynose
Wizard
lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.
 
Posts: 1,086
Karma: 4583858
Join Date: Jul 2012
Device: Palm Pilot M105
Unless kindlegen has something I guess there isn't any conditional HTML, although I did forget about the stuff that IE used.

PHP Code:
<!--[if IE6]>
    
Things here!
<![endif]--> 
lumpynose is offline   Reply With Quote
Old 08-22-2019, 05:55 PM   #6
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: 7,831
Karma: 76070063
Join Date: Apr 2010
Location: Phoenix, AZ
Device: K2, iPad, KFire, PPW, Voyage, and NookColor. 2 Droid, 1 Win8 ePUB rdrs
Quote:
Originally Posted by lumpynose View Post
Ah, ok; thanks guys. I'll have to think about how ugly I want to make my html in order to make the mobi output nice.

Is there a way to have conditional html? For example, in my css I have the following; is there anything equivalent for html?

PHP Code:
@media amzn-mobi {
...

NOT for HTML in KF7, because....no CSS. Righty?

Hitch
Hitch is offline   Reply With Quote
Old 08-22-2019, 07:08 PM   #7
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,066
Karma: 3778603
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by lumpynose View Post
Is there a way to have conditional html? For example, in my css I have the following; is there anything equivalent for html?

PHP Code:
@media amzn-mobi {
...

No. But you can do a bit of cheat You can employ something like:

Code:
@media amzn-mobi {
   .kf7 {
        display: normal;
   }

   .kf8 {
       display: none;
   }
}

@media not amzn-mobi {
   .kf7 {
        display: none;
   }

   .kf8 {
       display: normal;
   }
}
And to employ html code like the following:

Code:
<div class="kf7">
  <blockquote class="MyTable">
    <table class="YourTable" border="1">
      <thead>
        <tr>
          <th>First column</th>

          <th>Second Column</th>
        </tr>
      </thead>

      <tbody>
        <tr>
          <td>Some text here</td>

          <td>And more text here too</td>
        </tr>

        <tr>
          <td>This for ending</td>

          <td>And this too</td>
        </tr>
      </tbody>
    </table>
  </blockquote>
</div>

<div class="kf8">
  <table>
    <thead>
      <tr>
        <th>First column</th>

        <th>Second Column</th>
      </tr>
    </thead>

    <tbody>
      <tr>
        <td>Some text here</td>

        <td>And more text here too</td>
      </tr>

      <tr>
        <td>This for ending</td>

        <td>And this too</td>
      </tr>
    </tbody>
  </table>
</div>
Of that way, you duplicate the html code but the kf8 class won't be displayed on mobi7 and the kf7 class won't be displayed on kf8/KFX.
RbnJrg is online now   Reply With Quote
Old 08-22-2019, 09:16 PM   #8
lumpynose
Wizard
lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.lumpynose ought to be getting tired of karma fortunes by now.
 
Posts: 1,086
Karma: 4583858
Join Date: Jul 2012
Device: Palm Pilot M105
Quote:
Originally Posted by RbnJrg View Post
No. But you can do a bit of cheat You can employ something like:
...
Of that way, you duplicate the html code but the kf8 class won't be displayed on mobi7 and the kf7 class won't be displayed on kf8/KFX.
Yeah, that certainly would work, but I can't bring myself to have duplicated stuff in the file; it goes against the DRY principle (Don't Repeat Yourself).

Although I could use that to put a big warning at the top of each chapter saying something like "Upgrade your derned Kindle already!"
lumpynose is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
epub to mobi7, all text is italics lumpynose Kindle Formats 1 08-16-2019 06:11 PM
How to center images in OLD mobi7 for Voyage GrannyGrump Kindle Formats 16 07-13-2016 11:44 PM
merge MOBI7 and AZW3 gregorio Kindle Formats 1 10-29-2012 09:02 AM
eBooks of chess problems. Center table bug? Tibor ePub 6 03-05-2009 09:20 AM
Read books horizontally mapletony Sony Reader 10 01-25-2008 04:36 PM


All times are GMT -4. The time now is 09:08 AM.


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