Elementary Variants
These are classes for marking up variants of specific types of elements.
Naming Convention
Elementary variants classes carry the var-
prefix, e. g. var-standard-table
.
figure.var-feature
scss
figure.var-feature {
@include coloring.set-colors("feature", "alternate");
@include coloring.use-colors;
margin-inline: 0;
padding: svar(spacing-block-lg);
blockquote {
---no-stroke: true;
---indent: 0ch;
---marker-outdent: 1ch;
font-size: svar(font-size-4);
line-height: svar(line-3);
font-family: svar(font-family-display, svar(font-family-body));
}
> * {
max-inline-size: 85.7%;
margin-inline-start: auto;
@media (min-width: map.get(container.$sizes, "sm")) {
// Occupy bigger golden ratio part.
max-inline-size: 61.8%;
}
@media (min-width: map.get(container.$sizes, "lg")) {
// Occupy smaller golden ratio part.
max-inline-size: 38.2%;
}
}
}
Requires
$sizes@container (Map)
Main Navigation Bar
Rather opinonated styling for the first nav.var-menu
.
Navigation Menu
Common patterns for navigation menus. Separated into several aspects.
Modifier: +levelable
scss
nav.var-menu.\+levelable {
& > menu {
// Horizontal nav as long as items have enough space.
---threshold: #{$nav-wide};
@extend .lyo-switcher;
& > li {
display: block;
text-align: center;
}
}
}
Levelable menu. Places items on a horizontal level if enough space is available.
@mixin toggle-folded()
Toggle when folded.
Modifier: +foldable
scss
nav.var-menu.\+foldable,
nav.var-menu.\+foldable-when-stacked:where(:not(.\+levelable)) {
@include menu-foldable;
// Folded state on wide screen. (Only when explicitly toggled.)
@media (min-width: $nav-wide) {
& > input[id^="-toggle-state"]:checked {
& ~ menu {
@include menu-folded;
}
& ~ label[for^="-toggle-state"] > :first-child,
& ~ label[for^="-toggle-state"]:empty::after {
@include toggle-folded;
}
}
}
}
Always foldable menu.
Modifier: +foldable-when-stacked
scss
nav.var-menu.\+foldable-when-stacked {
@media (max-width: $nav-wide) {
@include menu-foldable;
}
}
Menu foldable only when stacked.
Modifier: +end
scss
nav.var-menu.\+end {
flex-direction: row-reverse;
}
Places toggle to the inline end (rhs in Latin). This only has an effect if the menu is foldable.
Modifier: +sticky
scss
nav.var-menu.\+sticky {
position: sticky;
inset-block-start: 0;
z-index: 1;
}
Sticky menu. Makes navbar stick to the top of the viewport.
table.var-standard-table
scss
table.var-standard-table {
---table-border-width: #{svar(stroke-width-table, svar(stroke-width-default))};
---table-border-style: #{svar(stroke-style-table, svar(stroke-style-default))};
---table-border-color: #{svar(stroke-color-table, svar(stroke-color-default))};
thead {
background-color: var(---background-heavy, svar(color-mark-contra));
}
tr:nth-child(2n) {
background-color: var(---background-light, svar(color-alternate-contra));
}
// Do not center `th` in vertical tables.
thead + tbody {
th:first-child {
text-align: start;
}
}
}
Standard table style.
In contrast to the neutral styles applied to the bare table
element
this adds some borders and stripes.