Quote:
Originally Posted by lumpynose
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-left: auto;
margin-right: auto;
border-collapse: collapse;
margin-top: 1em;
}
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).