Hi,
thanks for your question, and sorry for the trouble.
I’m not sure that I understand. Do you basically want the cells in row 4 and 5 to have the same background color?
Regards,
Tobias
Thread Starter
3n0rm
(@3n0rm)
Hi Tobias,
thank you for your help. Yes, that’s what I want, but I do not want to have to define the color switch because there will be much more of those tables. Actually, I want to tell that table that row 4 and 5 belong together and should act as one row (I have created row 5 in order to vertically align the values in column 3 and the corresponding text in column 4). So, is there a way to combine the last two rows to just one but to keep the cells in column 3 and 4 separate? Sorry, I hope you will know what I mean.
Regards,
Tatjana
Hi,
thanks for the explanation. Yes, I see what you mean, but unfortunately, I’ll have to disappoint you here. This is not possible to achieve with that approach, simply due to how HTML tables work in browsers. 🙁 Rows are always independent from each other, so that the only real solution here is to manually set the row colors.
Now, to not have to do it in the CSS code, you could maybe try the approach from https://ww.wp.xz.cn/support/topic/highlight-a-row-based-on-value/ With that, you could e.g. use the keywords “odd” and “even” and add those to a hidden column in the table. Then, you’d just need to define the CSS once and could assign a desired row color via those keywords (and also no need to use #rowspan# then).
Regards,
Tobias
Thread Starter
3n0rm
(@3n0rm)
Hi Tobias,
thank you so much for your help and your suggestions, I really appreciate it! I will definitely try it your way. Is there a documentation to the extension? I’m not sure I have understood how exactly to use the keywords. By hidden column, do you mean a column hidden via CSS? I’m sorry for bothering you, but I usually don’t work with tables.
Regards,
Tatjana
Hi Tatjana,
no, sorry, there’s no other documentation than that forums thread and the PHP file in the Extension itself, at this time. You could use a parameter value of odd||even instead of that YES in the example.
And yes, I mean hiding the column with CSS code.
Regards,
Tobias
Thread Starter
3n0rm
(@3n0rm)
Hi Tobias,
thank you so much for your help and the quick replies! I will try it the way you suggested, sounds like a good solution.
Regards,
Tatjana
Hi,
no problem, you are very welcome! 🙂 Good to hear that this helped!
Best wishes,
Tobias
P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!