pico/scss/content/_table.scss

63 lines
1.6 KiB
SCSS
Raw Permalink Normal View History

2022-10-23 10:47:50 +07:00
@use "sass:map";
2022-10-22 13:11:51 +07:00
@use "../settings" as *;
2022-10-23 10:47:50 +07:00
@if map.get($modules, "content/table") {
/**
* Table
*/
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
// Reboot based on :
// - normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css
// - sanitize.css v13.0.0 | CC0 1.0 Universal | github.com/csstools/sanitize.css
//
2022-10-23 10:47:50 +07:00
// 1. Collapse border spacing in all browsers (opinionated)
// 2. Remove text indentation from table contents in Chrome, Edge, and Safari
2024-01-25 01:42:54 +07:00
#{$parent-selector} :where(table) {
2022-10-23 10:47:50 +07:00
width: 100%;
border-collapse: collapse; // 1
border-spacing: 0;
text-indent: 0; // 2
}
2022-10-23 10:47:50 +07:00
// Pico
//
2019-11-27 15:31:49 +07:00
2022-10-23 10:47:50 +07:00
// Cells
2024-01-25 01:42:54 +07:00
#{$parent-selector} th,
#{$parent-selector} td {
2023-12-28 13:21:52 +07:00
padding: calc(var(#{$css-var-prefix}spacing) / 2) var(#{$css-var-prefix}spacing);
border-bottom: var(#{$css-var-prefix}border-width)
solid
var(#{$css-var-prefix}table-border-color);
background-color: var(#{$css-var-prefix}background-color);
color: var(#{$css-var-prefix}color);
font-weight: var(#{$css-var-prefix}font-weight);
2022-10-23 10:47:50 +07:00
text-align: left;
text-align: start;
}
// Footer
2024-01-25 01:42:54 +07:00
#{$parent-selector} tfoot {
2022-10-23 10:47:50 +07:00
th,
td {
2023-12-28 13:21:52 +07:00
border-top: var(#{$css-var-prefix}border-width)
solid
var(#{$css-var-prefix}table-border-color);
2022-10-23 10:47:50 +07:00
border-bottom: 0;
}
2021-12-31 17:01:01 +07:00
}
2022-10-23 10:47:50 +07:00
// Striped
2023-03-18 08:21:37 +07:00
@if enable-classes {
2024-01-25 01:42:54 +07:00
#{$parent-selector} table {
2023-03-18 08:21:37 +07:00
&.striped {
tbody tr:nth-child(odd) th,
tbody tr:nth-child(odd) td {
2023-12-28 13:21:52 +07:00
background-color: var(#{$css-var-prefix}table-row-stripped-background-color);
2023-03-18 08:21:37 +07:00
}
2022-10-23 10:47:50 +07:00
}
2021-07-02 16:54:41 +07:00
}
2020-09-29 08:38:35 +07:00
}
2022-10-15 23:22:12 +07:00
}