07-11-2013, 11:34 AM | #1 |
Connoisseur
Posts: 86
Karma: 470352
Join Date: Dec 2012
Device: Kindle Fire, IPad
|
Formatting a table question
I have an epub which is styled, passed validation and ready to go. However I need to add a page at the end of the book which is a table with images text and links on it. The original is a .docx which I converted to html and then imported the images and the html for the table. I assigned the stylesheet from the original and I have one problem. The table needs to be centered to line up with the rest of the book. How do I center the table and it's contents?
|
07-11-2013, 12:15 PM | #2 |
Color me gone
Posts: 2,089
Karma: 1445295
Join Date: Apr 2008
Location: Central Oregon Coast
Device: PRS-300
|
http://www.pigsgourdsandwikis.com/20...-ereaders.html
describes some ways to attempt this. The results are uneven depending on the reader. I succeeded in doing it with my Sony, but it knocked out some of the lines in the table, in a table that needed them. Be sure to check in the target reader whatever you do. |
Advert | |
|
07-11-2013, 02:10 PM | #3 |
Wizard
Posts: 4,520
Karma: 121692313
Join Date: Oct 2009
Location: Heemskerk, NL
Device: PRS-T1, Kobo Touch, Kobo Aura
|
Keep the tables simple. They can be a hit-or-miss and are unpredictable.
|
07-11-2013, 02:34 PM | #4 |
Grand Sorcerer
Posts: 5,185
Karma: 25133758
Join Date: Nov 2008
Location: SF Bay Area, California, USA
Device: Pocketbook Touch HD3 (Past: Kobo Mini, PEZ, PRS-505, Clié)
|
A 6" screen doesn't allow much in the way of tables; consider if there's any way to rearrange your data.
Tables display poorly on most ereaders. If the contents of the full width of the table won't fit on the screen, different readers do odd things with them; if a cell won't fit on the screen, same problem. Some might allow scrolling, or set them on the next page, or delete them entirely from view. Test tables on a couple of devices if you're making them for commercial ebooks. |
07-11-2013, 05:35 PM | #5 |
Wizard
Posts: 1,539
Karma: 6613969
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
|
Try using the following styles in your css stylesheet:
Code:
div.tab { display: block; width: 60%; /* here use the width you want */ height: auto; /* Important: don't forget this property */ margin-left: 20%; } table { width: 100%; text-align: center; border: 5px solid black; } td { margin: 0; padding: 0; text-indent: 0; text-align: center; } Code:
<div class="tab"> <table> <thead> <tr> <th>Lorem ipsum dolor sit amet</th> </tr> </thead> <tbody> <tr> <td>Nulla ac tellus nunc</td> </tr> <tr> <td>Phasellus imperdiet leo metus</td> </tr> <tr> <td>Donec metus ligula</td> </tr> <tr> <td>Etiam lobortis, massa ac aliquam auctor</td> </tr> </tbody> </table> </div> To center the "div block" we need to fix a width for it (what you want) and after that to set a margin-left according to the width. This left margin must be equal to: (100% - block width %) / 2 In the above example we have: (100% - 60%) / 2 = 20% Regards Rubén Last edited by RbnJrg; 07-11-2013 at 05:37 PM. |
Advert | |
|
07-12-2013, 04:48 AM | #6 | |
Guru
Posts: 878
Karma: 2457540
Join Date: Nov 2011
Device: none
|
Quote:
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Table formatting | Rob Vollman | Sigil | 28 | 06-23-2013 09:48 AM |
Fictionwise Formatting - [Back to Table of Contents] | JeremyR | General Discussions | 4 | 12-24-2010 10:10 AM |
RTF to Mobi to Kindle: Table Border and Formatting are lost | Starko | Calibre | 12 | 12-20-2010 05:46 AM |
line formatting formatting question | daesdaemar | Workshop | 9 | 02-06-2009 11:47 AM |