• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

alignment of table

Engaged ,
Dec 17, 2022 Dec 17, 2022

Copy link to clipboard

Copied

Hi,

 

There is a table in Id.

 

I exported it to EPUB.

The table looks OK on iPhone (Books app).

There is an alignment issue on Mac (Books app).

 

Do you have any comment on it?

 

Hosun

IdIdBooks app (iPhone)Books app (iPhone)Books app (Mac)Books app (Mac)

TOPICS
Feature request , How to

Views

850

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 15 Correct answers

Community Expert , Dec 18, 2022 Dec 18, 2022

Most ePub creators suggest that in a Reflowable ePub you should use an image for tables.

Likes

Translate

Translate
Community Expert , Dec 18, 2022 Dec 18, 2022

Have a look at Object Export Options.

Screenshot 2022-12-18 at 21.20.29.png

Likes

Translate

Translate
Community Expert , Dec 19, 2022 Dec 19, 2022

Using an image is a last-ditch option for tables with a layout too fussy or complex to let an e-book reader manage, like this —

JamesGiffordNitroPress_0-1671465507431.png

 

Most simple, linear tables (like the OP's) can be exported successfully. The trick is to focus on the actual exported table and not the one in the ID doc; this is one of those cases where a somewhat "distorted" layout is needed to lead the reader to a clean presentation. (The faults lie mostly in ID's refusal to export HTML padding, so you either have to reformat at

...

Likes

Translate

Translate
Community Expert , Dec 20, 2022 Dec 20, 2022

Try this:

 

Take the table out of a text box. It adds nothing in the way of control. Quick testing didn't show any useful effects from applying Object Export parameters.

 

As I suspected, nothing done within ID will force the table to expand to full width. My notes were incomplete but leaned this way; I've just proven it to my satisfaction. What you can do is apply cell styles with spacing to get a more pleasing layout — and as noted above, what you get/see in ID might be very odd or distorted t

...

Likes

Translate

Translate
Community Expert , Dec 20, 2022 Dec 20, 2022

You can make the CSS command as specfic as you like. Just "table" as the style will affect all tables. If you wanted it to affect only one ID style of table, give the style a name — Color Table — and then change the CSS style to:

table.Color-Table { width:100%; }

 

You can, of course, have any number of these style-definition pairs. You shouldn't need to open or edit the EPUB after export; the CSS style is applied by including it in the EPUB export "Additional CSS" list.

 

You could also make th

...

Likes

Translate

Translate
Community Expert , Dec 20, 2022 Dec 20, 2022

Maybe I wasn't clear; I thought we'd gone through a CSS mod before.

 

Take the table out of the text frame. It adds nothing. Put the table right after the paragraph you want it to follow; it's just "fancy text" and will stay there without having to be anchored. (I would also take the caption out of its text box, which does nothng; just make it a paragraph that is formatted and spaced appropriately.)

 

With a text editor like Notepad, create a file in the same folder called (for example) grimm.cs

...

Likes

Translate

Translate
Community Expert , Dec 20, 2022 Dec 20, 2022

There are two things I'm suggesting, here. One is optional.

 

You have your table in a text frame. This is unnecessary and while it may not affect the alignment issue, it's complicating things. Select the table, cut it, and paste it back into the text flow, outside of that text frame. Delete the text frame.

 

That won't fix anything by itself but it removes a layer of document complexity that can make other fixes harder or less predictable.

 

When you have the table as just part of the text flow

...

Likes

Translate

Translate
Community Expert , Dec 21, 2022 Dec 21, 2022

To start with, it looks as if you still have the table in a text frame. It doesn't need to be, and that makes things more complicated. So what follows may not work unless additional styling/CSS is applied to that text box.

 

As long as the table is just part of the text fow, this is a case where what you do in ID will happen in EPUB — center the table in the document, and it will export centered with no CSS override necessary.

 

Use the arrow keys to select the start of the table (you will get a

...

Likes

Translate

Translate
Community Expert , Dec 21, 2022 Dec 21, 2022

Tables will attach in different ways to adjacent paragraphs, including just "running on" from prior paragraph text or into following text. You want to make sure they are on a paragraph of their own:

 

[Paragraph in BODY style]¶

[Paragraph in centered style, holding Table]¶

[Paragraph in BODY or some other style]¶

 

That is, with hidden characters on, you should see a pilcrow at the end of each of these three paragraphs, the table included.

 

Likes

Translate

Translate
Community Expert , Dec 21, 2022 Dec 21, 2022

Apply whatever style you want or need to each of those three elements. They should be completely independent with the connection between the table and the following paragraph broken by the paragraph return.

 

I assume you want the regular body style on the last paragraph; apply it, and it should leave the table (and its paragraph) centered. That formatting should all export to EPUB without needing any CSS changes other than the width: statement.

 

Likes

Translate

Translate
Community Expert , Dec 22, 2022 Dec 22, 2022

I have never seen that error.

 

Try renaming the second instance — and always use meaningful paragraph style names that give some context. In this case, 'body paragraph' and 'body paragraph centered' would be more intuitive and might elimnate this odd collision.

 

You can also look at the global paragraph styles export list (click the 'hamburger' icon in the Paragraph Styles list, then select Edit All Export Tags). In that list, make sure every style, especially these two, have a unique export n

...

Likes

Translate

Translate
Community Expert , Dec 22, 2022 Dec 22, 2022

You can assign any export names to them; it does not affect the InDesign styles. Besides just general management, this feature is VERY useful when you want to maintain "sensible" InDesign style names but export more compact, HTML/CSS-friendly versions to the EPUB.

 

Likes

Translate

Translate
Community Expert , Dec 22, 2022 Dec 22, 2022

Tables get tricky because table and cell styles overlap in a hierarchy that's not always predictable.

 

Try creating a cell style with a white background and "none" or 0 for borders. If that doesn't work, apply thin white borders. One or the other should produce that "missing" cell appearance.

 

Likes

Translate

Translate
Community Expert , Dec 24, 2022 Dec 24, 2022

I don't see a problem in the latter example, unless that is with the white border.

 

I can't find my detail notes on tables so I may just spend some of this long weekend messing around with a redo and some things I didn't evaluate before.

 

Something you might try is adding 'border-collapse: separate;' to your table definition, to see if that affects the various adjoining borders in a positive or negative way. I'm pretty sure 'collapse' is the default value for both ID export and EPUB interpreta

...

Likes

Translate

Translate
Community Expert , Dec 24, 2022 Dec 24, 2022

And here's some interesting findings. I find that both border-collapse and empty-cells work in EPUB (Calibre/Thorium):

JamesGiffordNitroPress_0-1671922358777.png

This is a table with borders defined red, cell borders defined blue, collapse set to 'separated' and two cells left empty.

 

Kindle does not honor empty-cells but does follow everything else. Making your borders all 0/none/white and using these two commands might allow you to style the table the way you want, with slight white separation between the colored cells for definition

...

Likes

Translate

Translate
Community Expert ,
Dec 18, 2022 Dec 18, 2022

Copy link to clipboard

Copied

Most ePub creators suggest that in a Reflowable ePub you should use an image for tables.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 18, 2022 Dec 18, 2022

Copy link to clipboard

Copied

Would you tell me how I can treat table like image?

 

Hosun

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 18, 2022 Dec 18, 2022

Copy link to clipboard

Copied

Save it as a JPG (or take a screen-shot if that's difficult for you).

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 18, 2022 Dec 18, 2022

Copy link to clipboard

Copied

I would suggest using PNG rather than JPEG for text clarity.

 

David Creamer: Community Expert, Adobe Certified Instructor, and Adobe Certified Expert (since 1995)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 18, 2022 Dec 18, 2022

Copy link to clipboard

Copied

Now, it looks fine.

Thank you very much for all of you.

 

I have another question.

 

When I increase the font size on EPUB, the font size on table hardly changes.

Should I take it for granted?

 

Hosun

 

table (Books app on Mac)table (Books app on Mac)font size 1 (Books app on iPhone)font size 1 (Books app on iPhone)font size 2 (Books app on iPhone)font size 2 (Books app on iPhone)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 18, 2022 Dec 18, 2022

Copy link to clipboard

Copied

Have a look at Object Export Options.

Screenshot 2022-12-18 at 21.20.29.png

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 19, 2022 Dec 19, 2022

Copy link to clipboard

Copied

Which one should I choose?

 

Hosun

 

Screenshot 2022-12-19 at 7.47.12 PM.png

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2022 Dec 19, 2022

Copy link to clipboard

Copied

You need to experiment with each one and test your ePub on various readers and devices. It's an imprecise art!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 19, 2022 Dec 19, 2022

Copy link to clipboard

Copied

I tried relative to text size.

 

Font size in table is changing.

But table is not presented in full.

 

I'd rather go with default.

 

I can set the font size in table bigger from the beginning. (The current one is too small.)

On iPhone, I can see the table in flexibility by tapping and pinching.

 

Hosun

small font size (Books app on iPhone)small font size (Books app on iPhone)big font size (Books app on iPhone)big font size (Books app on iPhone)

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2022 Dec 19, 2022

Copy link to clipboard

Copied

Using an image is a last-ditch option for tables with a layout too fussy or complex to let an e-book reader manage, like this —

JamesGiffordNitroPress_0-1671465507431.png

 

Most simple, linear tables (like the OP's) can be exported successfully. The trick is to focus on the actual exported table and not the one in the ID doc; this is one of those cases where a somewhat "distorted" layout is needed to lead the reader to a clean presentation. (The faults lie mostly in ID's refusal to export HTML padding, so you either have to reformat at the CSS level or use wonky layout in ID to compensate.)

 

But it can be done, and IMHO live text is always better than imaged text.

 

The Object Export choice is not usually a major factor, but in this case I'd start with a local object setting of "None."

 


| Word & InDesign to Kindle & EPUB: a Pro Guide (Amazon)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 19, 2022 Dec 19, 2022

Copy link to clipboard

Copied

I made the current table just for excercize without considering the issue of HTML padding.

I will try again with the one with less cells and bigger font size.

 

What is OP in the first line of your reply?

 

Hosun 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 19, 2022 Dec 19, 2022

Copy link to clipboard

Copied

OP = Original Poster. Forum shorthand for whomever asked the original question.

 


| Word & InDesign to Kindle & EPUB: a Pro Guide (Amazon)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 20, 2022 Dec 20, 2022

Copy link to clipboard

Copied

Hi,

 

I moved the table to the far left of page on Id.

On EPUB, I sense that something takes up a lot of space from the left of the table.

It pushes down a green rectangle, which I drew at random.

 

Is there any workaround?

 

Hosun

 

IdIdBooks app (Mac)Books app (Mac)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 20, 2022 Dec 20, 2022

Copy link to clipboard

Copied

I'm not sure what's going on there. Let me experiment a little and I'll come back to this later today.

 

ETA: I can't replicate any part of this problem with a clean document. I also can't quite figure out where Object Export Options are coming into the mix, unless you have the table in a text frame. I don't think linear-text tables are an "object," at least for EPUB export.

 

Can you upload an INDD file that is showing this behavior?

 

 


| Word & InDesign to Kindle & EPUB: a Pro Guide (Amazon)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 20, 2022 Dec 20, 2022

Copy link to clipboard

Copied

I sent a file link to your Adobe Message.

 

Hosun

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 20, 2022 Dec 20, 2022

Copy link to clipboard

Copied

Try this:

 

Take the table out of a text box. It adds nothing in the way of control. Quick testing didn't show any useful effects from applying Object Export parameters.

 

As I suspected, nothing done within ID will force the table to expand to full width. My notes were incomplete but leaned this way; I've just proven it to my satisfaction. What you can do is apply cell styles with spacing to get a more pleasing layout — and as noted above, what you get/see in ID might be very odd or distorted to get a desired result in EPUB.

 

The only way I could make the table expand to full width was with, yes, CSS. If you add this CSS line to the export —

table { width:100%; }

— you get a full-width table with reasonably proportional spacing of the columns.

 

Not sure there's any other solutions.

 


| Word & InDesign to Kindle & EPUB: a Pro Guide (Amazon)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 20, 2022 Dec 20, 2022

Copy link to clipboard

Copied

Can I add width:100%; into table.No-Table-Style{ }?

 

And save it in Notepad++ and open EPUB.

 

Hosun

 

xhtmlxhtmlcsscsssave in Notepad++save in Notepad++

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 20, 2022 Dec 20, 2022

Copy link to clipboard

Copied

You can make the CSS command as specfic as you like. Just "table" as the style will affect all tables. If you wanted it to affect only one ID style of table, give the style a name — Color Table — and then change the CSS style to:

table.Color-Table { width:100%; }

 

You can, of course, have any number of these style-definition pairs. You shouldn't need to open or edit the EPUB after export; the CSS style is applied by including it in the EPUB export "Additional CSS" list.

 

You could also make the table 90% width and center it using CSS, and pretty much anything else possible on a web page with CSS control.

 


| Word & InDesign to Kindle & EPUB: a Pro Guide (Amazon)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 20, 2022 Dec 20, 2022

Copy link to clipboard

Copied

I tried but see no change. So, I have one thing to check.

 

1. I extracted EPUB to the folder.

2. I added one line (449) to css and saved it.

3. Is there anything for me to do for the original EPUB?

    or

    Saving css is enough?

 

Hosun

 

Screenshot 2022-12-21 at 6.37.59 AM.pngScreenshot 2022-12-21 at 6.41.11 AM.png

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 20, 2022 Dec 20, 2022

Copy link to clipboard

Copied

Maybe I wasn't clear; I thought we'd gone through a CSS mod before.

 

Take the table out of the text frame. It adds nothing. Put the table right after the paragraph you want it to follow; it's just "fancy text" and will stay there without having to be anchored. (I would also take the caption out of its text box, which does nothng; just make it a paragraph that is formatted and spaced appropriately.)

 

With a text editor like Notepad, create a file in the same folder called (for example) grimm.css.

 

Put that line of CSS code in grimm.css:

 

table.<Style-Name-Nere> { width:100%; }

 

(Substitute your table's style anme, such as Color-Table.)

When you export the document, under HTML & CSS, add a link to grimm.css:

JamesGiffordNitroPress_0-1671573628230.png

...which will appear in the list when you do it successfully.

 

Export. That CSS addendum will now be added to the EPUB, after all default code from ID, and will override all width settings for that table style.

 

You do NOT need to edit the EPUB file itself for this process. ID simply includes the extra CSS code for you.

 


| Word & InDesign to Kindle & EPUB: a Pro Guide (Amazon)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 20, 2022 Dec 20, 2022

Copy link to clipboard

Copied

I took the caption out of its text box.

I have difficulty in understanding what Take the table out of the text frame is.

 

You said two things.

1. Take the table out of the text frame

2. CSS

 

Should I do both things to make the table correct?

or

Should I go to CSS, if Take the table out of the text frame does not work.

 

Hosun

 

Screenshot 2022-12-21 at 7.53.17 AM.png

 

Hosun

 

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 20, 2022 Dec 20, 2022

Copy link to clipboard

Copied

There are two things I'm suggesting, here. One is optional.

 

You have your table in a text frame. This is unnecessary and while it may not affect the alignment issue, it's complicating things. Select the table, cut it, and paste it back into the text flow, outside of that text frame. Delete the text frame.

 

That won't fix anything by itself but it removes a layer of document complexity that can make other fixes harder or less predictable.

 

When you have the table as just part of the text flow, outside of its own text frame (along with the caption/title — it doesn't need to be in a frame, either), apply the CSS file as outlined above. That should give you a table that's full margin width.

 

You COULD skip taking the table and caption out of frames and just do the CSS fix, but I recommend that first step so that the frame-inside-a-frame layout doesn't cause other unexpected problems. (In the EPUB, it will result in a <div> around the table, which might cause readers to interpret the styling differently.)

 


| Word & InDesign to Kindle & EPUB: a Pro Guide (Amazon)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Dec 20, 2022 Dec 20, 2022

Copy link to clipboard

Copied

I got what I expected.

Thank you very much.

 

To place the table in the center horizontally, I put 

table {width:90%;
display:flex;
justify-content:center;
}
 
It doesn't work.
 
Do you have any solution?
 
Hosun
 
width:100%width:100%width:90%width:90%

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 21, 2022 Dec 21, 2022

Copy link to clipboard

Copied

To start with, it looks as if you still have the table in a text frame. It doesn't need to be, and that makes things more complicated. So what follows may not work unless additional styling/CSS is applied to that text box.

 

As long as the table is just part of the text fow, this is a case where what you do in ID will happen in EPUB — center the table in the document, and it will export centered with no CSS override necessary.

 

Use the arrow keys to select the start of the table (you will get a flashing cursor the height of the table). Center the paragraph the table is attached to — if it's just BODY or equivalent, use BODY CENTER. That will center the table in the ID doc (if you were to reduce the width so that the positioning were evident) and in the EPUB export.

 

Always start with that — make something work in the ID doc and see if it exports correctly. CSS is only needed when ID doesn't export what it has in the doc, or doesn't follow the same rules. You will probably still need the width declaration, but the other statements are unnecessary.

 


| Word & InDesign to Kindle & EPUB: a Pro Guide (Amazon)

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines