De-dupe .table-dark, add new border color utilities, and update table docs#30342
De-dupe .table-dark, add new border color utilities, and update table docs#30342
Conversation
|
For next steps, I'm wondering if we also remove the |
|
@mdo, if you remove the |
|
Yeah we could perhaps ditch those and create a broader suite of utilities. It was a huge ask awhile back to have light and dark background options. Might be a v6 thing. |
| And also works with table color classes: | ||
|
|
||
| {{< example >}} | ||
| <table class="table table-striped"> |
There was a problem hiding this comment.
This table looks pretty ugly 😄
There was a problem hiding this comment.
Yeah I know lol... remove it? Find a better example?
|
Wow, the |
This comment has been minimized.
This comment has been minimized.
|
One may even want to add in a |
e27c8bc to
1397d31
Compare
|
Rebased and recombobulated the commits here in case we want to pull out the border and background utility changes. |
CSS doesn't allow inheriting `border-color` on td/th elements when using shorthand notation (e.g., `border: 1px solid #eee`). By separating the values, and disabling clean-css on these rulesets, we allow a single utility class on the `.table` to color our entire table's borders.
- New background-colors: gray-500, gray-700, and black - New border-colors: gray-400, gray-600, and black Note that the border colors are all one shade darker than the backgrounds so that they maintain some contrast.
|
Can we use the unset to nested tables if dropping IE11 in v5? |
We could, but I guess CSS specificity will be a PITA |
Oh I forgot that.. |
|
CSS custom properties on the other hand... https://codepen.io/MartijnCuppens/pen/eYNVmzp @mdo, we probably better switch to a CSS custom properties approach which will help us out with the nesting issues. |
|
@MartijnCuppens Intereting idea. One might have to be careful which the CSS variable names.. perhaps |
|
@tmorehouse, of course. That was just a quick demo 😉 |
|
So I need to circle back around to this and check in on some things around inheritance and nesting. I don't think mixing the CSS vars and Sass makes sense necessarily? Maybe I'm missing something there. |
|
I'm working on an alternative solution, will open another PR soon. |
|
Has the use of linear-gradient been performance-tested in some way? I have an example where this makes Safari rendering extremely slow when scrolling. Removing the gradient helps, but obviously kills my striping. If this wasn't expected, I can have a look at creating an example and posting an issue. |
Please do if there are any performance issue |

Alternative to #30193. This ended up being a couple changes in one, hence the length title, but the two are connected.
De-duped .table-dark
Rather than deviate from the
$theme-colorspattern we have elsewhere, this PR removes the.table-darkfor changing the background, color, and border of a.table. Instead, this can be accomplished through all utilities.Also removes thead-dark/thead-light modifiers for utilities.
New border-color utils
To support the utilities-driven approach for replacing
.table-dark, I've added a few newborder-colorutilities. These are a subset of our available grays, but I do believe they provide an improved set of options without including all the grays (and thus duplicating$gray-900and$darkoptions). The new options have been added to the borders utilities docs page.New background-color utils
To match the border utilities, I've added one tint lighter for two gray backgrounds (didn't add
$gray-100as it's the same as$light). This way you can choose from additional gray backgrounds and still have a slight contrast in the border colors. Definitely interested in thoughts on this.Updated table docs
This also obviously updates the examples in the tables docs to reflect the new dark table approach, but also clarifies how inheritance comes into play with the table styles and the table borders. It also adds a new multiple
<tbody>example and tweaks a few other bits and pieces.https://deploy-preview-30342--twbs-bootstrap.netlify.com/docs/4.3/content/tables/
Closes #28480, fixes #27879, nullifies #30046, fixes #28160, and fixes #24529.