How to get 'sticky' column to work in table with a colspan?
I have a complex table -- see screenshot of top left. Requires scrolling in both dimensions.
I have got the sticky working for header row and first column OK, using:
Except for the sub-heading rows, for example "What to include and exclude", "Moving/Scheduling Items".
These are
<td colspan="6" class="sticky-column"</td>
.
Those sub-headings scroll horizontally.
How can I stop this, please?6 Replies
My AI suggests adding a selector
td[colspan]
, but even if that's a thing, it doesn't seem to help.td[colspan]
will select any TD with a colspan attribute set on it, which you could use to target them for a overflow: hidden;
. It's hard to say what would be a better solution without a live example thoughThanks. That didn't help by itself, but I then tried making it
colspan="3"
and together that works. I don't fully understand this, but perhaps its a way forward.which part do you not understand?
(genuine question btw, it's always better to understand a solution so you can use it again later!)
Thanks.
What I don't understand (yet) is why does colspan 6 move, but colspan 3 not move?
I think it has to do more with the content than with the colspan. It's not really possible to tell without seeing the code in my own browser though