View Single Post
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,834
Karma: 8700631
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 offline   Reply With Quote