picocss/scss/content/_table.scss

81 lines
2.6 KiB
SCSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@use "sass:map";
@use "../settings" as *;
@if map.get($modules, "content/table") {
/**
* Table
*/
// 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
//
// 1. Collapse border spacing in all browsers (opinionated)
// 2. Remove text indentation from table contents in Chrome, Edge, and Safari
#{$parent-selector} :where(table) {
width: 100%;
border-collapse: collapse; // 1
border-spacing: 0;
text-indent: 0; // 2
}
// Pico
//
// Cells
#{$parent-selector} table th,
#{$parent-selector} table td {
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);
text-align: left;
text-align: start;
}
#{$parent-selector} table > caption {
margin-block: calc(var(#{$css-var-prefix}block-spacing-vertical) * 0.5);
padding: calc(var(#{$css-var-prefix}spacing) / 2) var(#{$css-var-prefix}spacing);
background-color: var(#{$css-var-prefix}table-row-stripped-background-color);
color: var(#{$css-var-prefix}h3-color);
font-weight: var(#{$css-var-prefix}font-weight);
font-size: 1.25rem;
text-align: center;
}
// Footer
#{$parent-selector} table > tfoot {
th,
td {
border-top: var(#{$css-var-prefix}border-width)
solid
var(#{$css-var-prefix}table-border-color);
border-bottom: 0;
}
}
#{$parent-selector} table > caption {
margin-block: calc(var(#{$css-var-prefix}block-spacing-vertical) * 0.5);
background-color: var(#{$css-var-prefix}table-row-stripped-background-color);
color: var(#{$css-var-prefix}h3-color);
font-weight: var(#{$css-var-prefix}font-weight);
font-size: 1.25rem;
text-align: center;
}
// Striped
@if enable-classes {
/* clean-css ignore:start */
#{$parent-selector} table.striped {
tbody tr:nth-child(odd of :not([hidden])) th,
tbody tr:nth-child(odd of :not([hidden])) td {
background-color: var(#{$css-var-prefix}table-row-stripped-background-color);
}
}
/* clean-css ignore:end */
}
}