Cell Spacing in Tables? Sorta.

Two attributes of table cells have a long history in the web design field: "cellpadding" (equivalent to InDesign's "cell inset" or "text frame inset") and "cellspacing," which is the amount...

Two attributes of table cells have a long history in the web design field: “cellpadding” (equivalent to InDesign’s “cell inset” or “text frame inset”) and “cellspacing,” which is the amount of space in between the cells. This HTML Code Tutorial page has a decent explanation of the two, with illustrations.

As far as I know, no page layout program with a Table function has a cell spacing feature, including InDesign. So whenever I hear someone ask “Where’s the Cell Spacing command in InDesign CS2?” (as I did this morning on the InDesign User forum at Adobe.com … this post expands on my reply there) I know the user must have a web design background.

InDesign does not have any way of setting a cell space measure. Cells are separated by, and share, a single stroke. If you apply conflicting stroke settings to adjacent cells, the most-recently applied one “wins.”

If you really need cell spacing, though, I do have a …

Cell Spacing Workaround

Depending on the table you can sometimes fake the look of cell spacing with the type of stroke you use.

For example, if you don’t need color inside the cells, try putting the table over a colored background or over an image, then select the whole table and use the Stroke palette to apply a 6 pt or larger stroke of the type “thin-thin,” colored Black, with a None (transparent) gap color.

You end up with a black grid of cells that appear to be spaced apart, and you can see the background objects through the cells (behind the text) and spaces between the cells. Here’s an example:

cellspacing grid

You can make the stroke a heavier weight to increase the “spacing” between the cells, but of course that increases the weight of the opaque portions of the stroke as well.

The stroke called “thin-thin” uses a ratio of 25-50-25: The stripes are 25% of the stroke weight each and the space between them is 50%. I made a custom stroke style from the Stroke palette menu with a ratio of 10-80-10 (which I called “thinner-thinner” … heh) and applied it to the examples on this page.

The problem is that you can’t fill the cells with a color, otherwise the color bleeds into the space in between the cells … the strokes always “align to center” in tables, so the color bleeds halfway into the empty space. You can see that in the image above, where I filled the first cell with green.

Workarounds Inside Workarounds

If you need color inside the cells, but still want the space in between the cells to be transparent, the best I’ve been able to come up with is to fill the cells with colored tables.

Click inside a cell you’d like filled with a color and set its cell insets to 0p0. Then choose Table > Insert Table, specifying one row and one column. Click OK and the table almost fills the cell. Select the embedded table and in Table Options set its stroke to 0 and set space above/below to 0p0. While it’s still selected, fill it with a color from the Swatches palette.

You may have to drag on the embedded cell’s borders to get it to fill the cell exactly, but once the first one is perfect, you can copy/paste it into other cells that are the same size.

The example below shows a few of the same grid’s cells filled with colored one-celled tables. The ones upper left still have the grid showing. To make the “floating” red cells in the center, I selected the cells and changed the stroke color to None (but didn’t change the weight):

cellspacing with floats

A lot of pain in the butt workarounds for this, I know! To tell the truth, if I had to create this effect for a real project, I’d probably just create a grid of small text frames and rely on grouping and align/distribute to do what I needed, if I could get away with it. On the other hand, if I was faced with a lot of tabular data, I might just go this route.

Bookmark
Please login to bookmark Close

This article was last modified on December 18, 2021

Comments (10)

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading comments...