]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Remove thicker border on table thead elements
authorMark Otto <markdotto@gmail.com>
Fri, 25 Feb 2022 21:58:08 +0000 (13:58 -0800)
committerMark Otto <otto@github.com>
Mon, 28 Feb 2022 19:21:53 +0000 (11:21 -0800)
Use the new .table-group-divider to create your own dividers as desired. Would love to find a better way to handle border-color for this, but for now, this is at least opt-in.

I've applied it by default in another way for our docs tables to help differentiate our content vs our components.

Fixes #35342

scss/_tables.scss
site/assets/scss/_content.scss
site/content/docs/5.1/content/tables.md

index 2045111043a45b81580825933be4908121263518..c523e6677f21056fcf4ce6c482acf16ef8c99932 100644 (file)
   > thead {
     vertical-align: bottom;
   }
-
-  // Highlight border color between thead, tbody and tfoot.
-  > :not(:first-child) {
-    border-top: (2 * $table-border-width) solid $table-group-separator-color;
-  }
 }
 
+.table-group-divider {
+  border-top: calc(2 * $table-border-width) solid $table-group-separator-color; // stylelint-disable-line function-disallowed-list
+}
 
 //
 // Change placement of captions with a class
index fa290dabc8985fd2fb27a5da94ae527e34d09af8..3dd380ef709bfcb9d51f108f60094fd3f63aa5ff 100644 (file)
       }
     }
 
+    thead {
+      border-bottom: 2px solid currentColor;
+    }
+
     th,
     td {
       &:first-child {
index 88f91576211a9bb6bec8b149fef1f506e9ace81e..577e3ef84c2d90a383f55d09f1d71d6c9921dd5b 100644 (file)
@@ -260,6 +260,42 @@ Add `.table-sm` to make any `.table` more compact by cutting all cell `padding`
 
 {{< table class="table table-dark table-sm" >}}
 
+## Table group dividers
+
+Add a thicker border, darker between table groups—`<thead>`, `<tbody>`, and `<tfoot>`—with `.table-group-divider`. Customize the color by changing the `border-top-color` (which we don't currently provide a utility class for at this time).
+
+{{< example >}}
+<table class="table">
+  <thead>
+    <tr>
+      <th scope="col">#</th>
+      <th scope="col">First</th>
+      <th scope="col">Last</th>
+      <th scope="col">Handle</th>
+    </tr>
+  </thead>
+  <tbody class="table-group-divider">
+    <tr>
+      <th scope="row">1</th>
+      <td>Mark</td>
+      <td>Otto</td>
+      <td>@mdo</td>
+    </tr>
+    <tr>
+      <th scope="row">2</th>
+      <td>Jacob</td>
+      <td>Thornton</td>
+      <td>@fat</td>
+    </tr>
+    <tr>
+      <th scope="row">3</th>
+      <td colspan="2">Larry the Bird</td>
+      <td>@twitter</td>
+    </tr>
+  </tbody>
+</table>
+{{< /example >}}
+
 ## Vertical alignment
 
 Table cells of `<thead>` are always vertical aligned to the bottom. Table cells in `<tbody>` inherit their alignment from `<table>` and are aligned to the top by default. Use the [vertical align]({{< docsref "/utilities/vertical-align" >}}) classes to re-align where needed.