Convert to css style comments, part 2.
This commit is contained in:
parent
2eee4d3c24
commit
9f8b1eaf18
9 changed files with 234 additions and 201 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// Base styles.
|
||||
/* Base styles. */
|
||||
|
||||
// Broken into modular pieces to make it easier to edit.
|
||||
/* Broken into modular pieces to make it easier to edit. */
|
||||
@import 'reset/reset';
|
||||
@import 'document/document';
|
||||
@import 'forms/forms';
|
||||
|
|
|
|||
|
|
@ -1,17 +1,20 @@
|
|||
// Document
|
||||
/* Document */
|
||||
|
||||
html {
|
||||
// Change the default font family in all browsers.
|
||||
/* Change the default font family in all browsers. */
|
||||
font-family: var(--ff-body);
|
||||
// Set base font size in percent.
|
||||
|
||||
/* Set base font size in percent. */
|
||||
font-size: calc(var(--base-font-size) / 16 * 100%);
|
||||
// Set text colour.
|
||||
|
||||
/* Set text colour. */
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
body {
|
||||
// Correct the line height in all browsers.
|
||||
/* Correct the line height in all browsers. */
|
||||
line-height: var(--base-line-height);
|
||||
// Accent colour for forms.
|
||||
|
||||
/* Accent colour for forms. */
|
||||
accent-color: var(--color-accent);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Form defaults.
|
||||
/* Form defaults. */
|
||||
|
||||
form {
|
||||
// Add vertical rhythm margins.
|
||||
/* Add vertical rhythm margins. */
|
||||
margin-block: 0 var(--spacing-m);
|
||||
}
|
||||
|
||||
|
|
@ -14,13 +14,13 @@ select {
|
|||
label {
|
||||
font-weight: var(--fw-bold);
|
||||
|
||||
// Display as block if before input.
|
||||
/* Display as block if before input. */
|
||||
&:has(+ input),
|
||||
&:has(+ textarea){
|
||||
display: block;
|
||||
}
|
||||
|
||||
// Mark field as required if needed.
|
||||
/* Mark field as required if needed. */
|
||||
&:has(+ :required) {
|
||||
&::after {
|
||||
content: '*';
|
||||
|
|
@ -29,7 +29,7 @@ label {
|
|||
}
|
||||
}
|
||||
|
||||
// Valid and invalid state.
|
||||
/* Valid and invalid state. */
|
||||
input,
|
||||
textarea {
|
||||
&:user-valid {
|
||||
|
|
@ -54,7 +54,7 @@ textarea {
|
|||
}
|
||||
}
|
||||
|
||||
// Set max text line width for readability.
|
||||
/* Set max text line width for readability. */
|
||||
input,
|
||||
label,
|
||||
textarea,
|
||||
|
|
@ -66,31 +66,31 @@ fieldset {
|
|||
border: 1px solid var(--color-border);
|
||||
}
|
||||
|
||||
// Make field where you enter more info a bit wider.
|
||||
/* Make field where you enter more info a bit wider. */
|
||||
[type='email'],
|
||||
[type='password'],
|
||||
[type='range'],
|
||||
[type='search'],
|
||||
[type='url'] {
|
||||
// Writing "Min" instead of "min" to force use of css "min()" instead of sass "min()".
|
||||
// stylelint-disable-next-line function-name-case
|
||||
/* Writing "Min" instead of "min" to force use of css "min()" instead of sass "min()". */
|
||||
/* stylelint-disable-next-line function-name-case */
|
||||
width: Min(20em, 100%);
|
||||
}
|
||||
|
||||
// Make field where you enter more info a bit wider.
|
||||
/* Make field where you enter more info a bit wider. */
|
||||
[type='text'],
|
||||
textarea {
|
||||
// Writing "Min" instead of "min" to force use of css "min()" instead of sass "min()".
|
||||
// stylelint-disable-next-line function-name-case
|
||||
/* Writing "Min" instead of "min" to force use of css "min()" instead of sass "min()". */
|
||||
/* stylelint-disable-next-line function-name-case */
|
||||
width: Min(30em, 100%);
|
||||
}
|
||||
|
||||
// Make sure textareas without a rows attribute are not tiny.
|
||||
/* Make sure textareas without a rows attribute are not tiny. */
|
||||
textarea:not([rows]) {
|
||||
min-height: 7lh;
|
||||
}
|
||||
|
||||
// For forms with multibple fields show submit button below the form.
|
||||
/* For forms with multibple fields show submit button below the form. */
|
||||
input:not(:only-of-type),
|
||||
textarea {
|
||||
& + [type='submit'] {
|
||||
|
|
@ -98,7 +98,7 @@ textarea {
|
|||
}
|
||||
}
|
||||
|
||||
// For forms on mobile with single field add space between it and the submit button.
|
||||
/* For forms on mobile with single field add space between it and the submit button. */
|
||||
@media (min-width: 666px) {
|
||||
input:only-of-type {
|
||||
&:has(+ [type='submit']) {
|
||||
|
|
|
|||
|
|
@ -1,25 +1,28 @@
|
|||
// Grouping content
|
||||
/* Grouping content */
|
||||
|
||||
// Block quotes
|
||||
/* Block quotes */
|
||||
|
||||
blockquote {
|
||||
// Add vertical rhythm margins.
|
||||
/* Add vertical rhythm margins. */
|
||||
margin-block: 0 var(--spacing-m);
|
||||
// Nicer text wrap, e.g. no lone word on last line.
|
||||
|
||||
/* Nicer text wrap, e.g. no lone word on last line. */
|
||||
text-wrap: pretty;
|
||||
// Also indent the quote on both sides.
|
||||
|
||||
/* Also indent the quote on both sides. */
|
||||
margin-inline: var(--indent-amount);
|
||||
// Set max text line width in main for readability.
|
||||
|
||||
/* Set max text line width in main for readability. */
|
||||
max-width: var(--max-line-width);
|
||||
}
|
||||
|
||||
// Lists
|
||||
/* Lists */
|
||||
|
||||
dl,
|
||||
ol,
|
||||
ul,
|
||||
menu {
|
||||
// Add vertical rhythm margins.
|
||||
/* Add vertical rhythm margins. */
|
||||
margin-block: 0 var(--spacing-m);
|
||||
}
|
||||
|
||||
|
|
@ -30,7 +33,8 @@ dt {
|
|||
dd {
|
||||
margin: 0;
|
||||
margin-inline-start: var(--indent-amount);
|
||||
// Nicer text wrap, e.g. no lone word on last line.
|
||||
|
||||
/* Nicer text wrap, e.g. no lone word on last line. */
|
||||
text-wrap: pretty;
|
||||
}
|
||||
|
||||
|
|
@ -40,7 +44,7 @@ menu {
|
|||
padding: 0;
|
||||
padding-inline-start: var(--indent-amount);
|
||||
|
||||
// Turn off margins on nested lists.
|
||||
/* Turn off margins on nested lists. */
|
||||
ol,
|
||||
ul,
|
||||
menu {
|
||||
|
|
@ -49,49 +53,51 @@ menu {
|
|||
}
|
||||
|
||||
li {
|
||||
// Nicer text wrap, e.g. no lone word on last line.
|
||||
/* Nicer text wrap, e.g. no lone word on last line. */
|
||||
text-wrap: pretty;
|
||||
// Set max text line width in main for readability.
|
||||
|
||||
/* Set max text line width in main for readability. */
|
||||
.main & {
|
||||
max-width: var(--max-line-width);
|
||||
}
|
||||
}
|
||||
|
||||
// Horizontal rule
|
||||
/* Horizontal rule */
|
||||
|
||||
hr {
|
||||
// Add vertical rhythm margins.
|
||||
/* Add vertical rhythm margins. */
|
||||
margin-block: var(--spacing-m);
|
||||
border: 0;
|
||||
border-block-start: 1px solid var(--color-border);
|
||||
height: 0;
|
||||
}
|
||||
|
||||
// Paragraphs
|
||||
/* Paragraphs */
|
||||
|
||||
p {
|
||||
// Add vertical rhythm margins.
|
||||
/* Add vertical rhythm margins. */
|
||||
margin-block: 0 var(--spacing-m);
|
||||
// Nicer text wrap, e.g. no lone word on last line.
|
||||
|
||||
/* Nicer text wrap, e.g. no lone word on last line. */
|
||||
text-wrap: pretty;
|
||||
|
||||
// Set max text line width in main for readability.
|
||||
/* Set max text line width in main for readability. */
|
||||
.main & {
|
||||
max-width: var(--max-line-width);
|
||||
}
|
||||
}
|
||||
|
||||
// Preformatted text
|
||||
/* Preformatted text */
|
||||
|
||||
pre {
|
||||
// Add vertical rhythm margins.
|
||||
/* Add vertical rhythm margins. */
|
||||
margin-block: 0 var(--spacing-m);
|
||||
font-family: var(--ff-monospace);
|
||||
}
|
||||
|
||||
// Code
|
||||
/* Code */
|
||||
|
||||
// Do not set colour for code with syntax highlighting.
|
||||
/* Do not set colour for code with syntax highlighting. */
|
||||
code:not([data-lang]),
|
||||
kbd,
|
||||
samp {
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@ h6,
|
|||
line-height: var(--heading-line-height);
|
||||
text-wrap: balance;
|
||||
|
||||
// Smaller margin when a headeing is right after another heading.
|
||||
/* Smaller margin when a headeing is right after another heading. */
|
||||
& + & {
|
||||
margin-block-start: .75em
|
||||
}
|
||||
|
||||
// Set max text line width in main for readability.
|
||||
/* Set max text line width in main for readability. */
|
||||
.main & {
|
||||
max-width: var(--max-line-width);
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@ h6,
|
|||
|
||||
h1,
|
||||
%h1 {
|
||||
// h1 only on top of page so different margins.
|
||||
/* h1 only on top of page so different margins. */
|
||||
margin-block-start: var(--spacing-m);
|
||||
margin-block-end: var(--spacing-xs);
|
||||
font-size: var(--fs-xxl);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// Figure and image.
|
||||
/* Figure and image. */
|
||||
|
||||
figure,
|
||||
img {
|
||||
|
|
@ -30,16 +30,18 @@ img {
|
|||
}
|
||||
|
||||
figure {
|
||||
// Add vertical rhythm margins.
|
||||
/* Add vertical rhythm margins. */
|
||||
margin-block: 0 var(--spacing-m);
|
||||
|
||||
&.image {
|
||||
figcaption {
|
||||
padding-block-start: var(--image-padding);
|
||||
contain: inline-size;
|
||||
// Set max text line width in main for readability.
|
||||
|
||||
/* Set max text line width in main for readability. */
|
||||
max-width: var(--max-line-width);
|
||||
// Nicer text wrap, e.g. no lone word on last line.
|
||||
|
||||
/* Nicer text wrap, e.g. no lone word on last line. */
|
||||
text-wrap: pretty;
|
||||
|
||||
@media (min-width: 666px) {
|
||||
|
|
@ -79,7 +81,7 @@ figure {
|
|||
|
||||
img {
|
||||
&.image {
|
||||
// Add vertical rhythm margins.
|
||||
/* Add vertical rhythm margins. */
|
||||
margin-block: 0 var(--spacing-m);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,13 +32,13 @@ a:active {
|
|||
color: var(--color-link-active);
|
||||
}
|
||||
|
||||
// Remove underline from links to current page to
|
||||
// indicate that there is no need to click on it.
|
||||
/* Remove underline from links to current page to */
|
||||
/* indicate that there is no need to click on it. */
|
||||
[aria-current] {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
// Use smooth scrolling unless user prefer less motion.
|
||||
/* Use smooth scrolling unless user prefer less motion. */
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
:has(:target) {
|
||||
scroll-behavior: smooth;
|
||||
|
|
@ -58,7 +58,7 @@ a:active {
|
|||
}
|
||||
}
|
||||
|
||||
// Inverted links, for dark backgrounds.
|
||||
/* Inverted links, for dark backgrounds. */
|
||||
.link-inverted,
|
||||
%link-inverted {
|
||||
a {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
// stylelint-disable property-no-vendor-prefix
|
||||
/* stylelint-disable property-no-vendor-prefix */
|
||||
|
||||
// Reset browsers to some sane defaults.
|
||||
/* Reset browsers to some sane defaults. */
|
||||
|
||||
// Document
|
||||
/* Document */
|
||||
|
||||
// Use the saner border-box model for all elements.
|
||||
/* Use the saner border-box model for all elements. */
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
|
|
@ -12,36 +12,38 @@
|
|||
}
|
||||
|
||||
:root {
|
||||
// Activate transition to intrinsic sizes like auto and fit-content.
|
||||
/* Activate transition to intrinsic sizes like auto and fit-content. */
|
||||
interpolate-size: allow-keywords;
|
||||
}
|
||||
|
||||
// Transitioning page view.
|
||||
/* Transitioning page view. */
|
||||
@view-transition {
|
||||
navigation: auto;
|
||||
}
|
||||
|
||||
html {
|
||||
// Prevent adjustments of font size.
|
||||
/* Prevent adjustments of font size. */
|
||||
-webkit-text-size-adjust: none;
|
||||
text-size-adjust: none;
|
||||
// Improve text rendering.
|
||||
|
||||
/* Improve text rendering. */
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
// Sections
|
||||
/* Sections */
|
||||
|
||||
body {
|
||||
// Remove the margin in all browsers.
|
||||
/* Remove the margin in all browsers. */
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
// On short pages, we want the body to fill the entire height
|
||||
// of the browser.
|
||||
|
||||
/* On short pages, we want the body to fill the entire height */
|
||||
/* of the browser. */
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
// Embedded content
|
||||
/* Embedded content */
|
||||
|
||||
img,
|
||||
svg,
|
||||
|
|
@ -66,7 +68,7 @@ figure {
|
|||
margin-inline: 0;
|
||||
}
|
||||
|
||||
// Form defaults.
|
||||
/* Form defaults. */
|
||||
|
||||
input,
|
||||
button,
|
||||
|
|
@ -79,12 +81,12 @@ select {
|
|||
|
||||
[type='search'] {
|
||||
@media (min-width: 666px) {
|
||||
// Correct the odd appearance in Safari on desktop.
|
||||
/* Correct the odd appearance in Safari on desktop. */
|
||||
-webkit-appearance: textfield;
|
||||
}
|
||||
}
|
||||
|
||||
// Code
|
||||
/* Code */
|
||||
|
||||
code,
|
||||
kbd,
|
||||
|
|
@ -92,7 +94,7 @@ samp {
|
|||
font-family: var(--ff-monospace);
|
||||
}
|
||||
|
||||
// Numbers
|
||||
/* Numbers */
|
||||
|
||||
td,
|
||||
math,
|
||||
|
|
|
|||
|
|
@ -1,29 +1,32 @@
|
|||
// Tables
|
||||
/* Tables */
|
||||
|
||||
table {
|
||||
// Add vertical rhythm margins.
|
||||
/* Add vertical rhythm margins. */
|
||||
margin-block: 0 var(--spacing-m);
|
||||
// Remove default spacing between table cells.
|
||||
|
||||
/* Remove default spacing between table cells. */
|
||||
border-collapse: collapse;
|
||||
// Prevent cramped-looking tables
|
||||
|
||||
/* Prevent cramped-looking tables */
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td,
|
||||
th {
|
||||
// Remove most spacing between table cells.
|
||||
/* Remove most spacing between table cells. */
|
||||
padding: 0;
|
||||
// Align content to top of cells.
|
||||
|
||||
/* Align content to top of cells. */
|
||||
vertical-align: text-top;
|
||||
}
|
||||
|
||||
th {
|
||||
// Align content to bottom of headers.
|
||||
/* Align content to bottom of headers. */
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
caption,
|
||||
th {
|
||||
// Align all text the same.
|
||||
/* Align all text the same. */
|
||||
text-align: start;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue