bootstrap
bootstrap copied to clipboard
Table striped row color setting for included elements - Bootstrap version 5.1.1 vs. 5.1.3
Prerequisites
- [X] I have searched for duplicate or closed issues
- [X] I have validated any HTML to avoid common problems
- [X] I have read the contributing guidelines
Describe the issue
Up to version 5.1.1 it was this in the stylesheet
.table-striped > tbody > tr:nth-of-type(odd) { --bs-table-accent-bg: var(--bs-table-striped-bg); color: var(--bs-table-striped-color); }
from 5.1.2 on it is
.table-striped > tbody > tr:nth-of-type(odd) > * { --bs-table-accent-bg: var(--bs-table-striped-bg); color: var(--bs-table-striped-color); }
Now all child elements get a color. Often enough this color setting overrides the one given to the element. Is there a special reason for the change? Now it's more difficult setting ones own colors for the elements in a table row. And Bootstrap is more opinionated in regard to the color setting in table row.
Btw. same applies to the setting for the .table-hover > tbody > tr:hover
vs. .table-hover > tbody > tr:hover > *
Reduced test cases
see description
What operating system(s) are you seeing the problem on?
Windows
What browser(s) are you seeing the problem on?
No response
What version of Bootstrap are you using?
5.1.1 vs. 5.1.3
#34799 seems to be a breaking change.
I join the ZeEmEs request.
I use bootstrap within an asp.net project.
This change has prevented me from upgrading from version 5.1.1 to 5.1.2 (5.1.3 at the time of writing this post is not available as a nuget package).
In version 5.1.1 when I use a table of type table-striped I can customize the color of the font used in the headers using the statement:
Now, with this change, it would force me to have to personalize the color of the font used in the table headers, going column by column.
Going through all the code to make this change is really a pain.
This was discussed here - https://stackoverflow.com/questions/72757301/applying-text-success-to-a-bootstrap-5-table-row-that-is-striped-has-no-effect/72757379
@dippas thanks for linking a stackoverflow that links to this thread...