Style bug when merging cells
-
Simple issue here. When you merge cells, the HTML output still contains extra <td> tags marked with attributes to keep them hidden.
When using borders, the default styles make use of the :first-child and :last-child CSS selectors.This selector is broken with merged cells because it targets the <td> which is visually hidden. So the border style does not get set.
Or to put another way, the right-border of the merged cell will disappear because last-child is targeting a <td> which can’t be seen.Here is a screenshot: https://www.dropbox.com/s/a8m0f1dybws98bu/cell%20styles.jpg?dl=0
You can see the right border is missing, again because the <td> actually exists in the source code, but is visually hidden, so the border doesn’t show up. If I delete the <td>, the border shows up fine.
So the real question is, when cells are merged, why does it still output the ghost <td> that shouldn’t even be there?
Frankly, I don’t know how to target a merged cell like this to make the border show up, but only when it is against the right edge of the table.
Sometimes I might have merged cells within the table that don’t touch the outer border. I’m not sure I can fix this with just CSS, so that’s why I’m reporting it. Something has to be done with targeting the merged cell right border when it’s against the right edge of the table, or stop outputting ghost <td>s when the sibling has a colspan.Thanks!
The topic ‘Style bug when merging cells’ is closed to new replies.