1
0
Fork 0
mirror of https://git.sr.ht/~seirdy/seirdy.one synced 2024-12-17 22:32:10 +00:00

CSS: fix misaligned inline nav, simplify

Fixing the misaligned inline nav using "inline-block" also made it
obvious that I can simplify compound selectors. The max number of
compound selectors has dropped from 4 to 2. Update stylelint configs to
reflect this.

Also fix containment to reflect a prior change (webmentions are a
section, not a footer.)
This commit is contained in:
Rohan Kumar 2022-05-01 21:59:11 -07:00
parent 8bcfa63859
commit c9a1958264
No known key found for this signature in database
GPG key ID: 1E892DB2A5F84479
4 changed files with 30 additions and 29 deletions

View file

@ -4,6 +4,6 @@
"font-family-no-duplicate-names": [ true, { "ignoreFontFamilyNames": ["monospace"] } ], "font-family-no-duplicate-names": [ true, { "ignoreFontFamilyNames": ["monospace"] } ],
"indentation": "tab", "indentation": "tab",
"max-nesting-depth": 1, "max-nesting-depth": 1,
"selector-max-compound-selectors": 4 "selector-max-compound-selectors": 2
} }
} }

View file

@ -20,8 +20,8 @@ html {
/* Default font sizes are one-size-fits-all; they're optimized for a /* Default font sizes are one-size-fits-all; they're optimized for a
* wide variety of complex pages. For single-column websites like * wide variety of complex pages. For single-column websites like
* mine, it's ideal to bump it up ever so slightly. This also makes * mine, it's ideal to bump it up ever so slightly. This also makes
* <sup>, <sub>, <small>, etc. large enough to have decent contrast with * <sup>, <sub>, <small>, etc. large enough to have decent contrast
* minimal adjustment. * with minimal adjustment.
* Only do this on screen, since printouts already improve legibility * Only do this on screen, since printouts already improve legibility
* and cost paper + ink. */ * and cost paper + ink. */
font-size: 105%; font-size: 105%;
@ -32,7 +32,7 @@ html {
/* WCAG recommends a max line width. Not everyone can resize the /* WCAG recommends a max line width. Not everyone can resize the
* viewport. * viewport.
* 45em is the lowest reasonable width for titles, nav, footers, etc */ * 45em = lowest acceptable width for titles, nav, footers, etc */
max-width: 45em; max-width: 45em;
padding: 0 3%; padding: 0 3%;
} }
@ -61,7 +61,7 @@ blockquote {
padding-left: .8em; padding-left: .8em;
} }
/* narrow screens: reduce list indentation /* narrow screens: reduce list indentation, hyphenate nested lists
* touch screens: lists of links should be * touch screens: lists of links should be
* easy to tap so give them some spacing. */ * easy to tap so give them some spacing. */
dd, dd,
@ -96,36 +96,34 @@ h1 {
} }
/* Compensate for misalignment caused by a padding increase. */ /* Compensate for misalignment caused by a padding increase. */
header nav { header nav,
margin-left: -.375em;
}
footer nav { footer nav {
margin: -.375em; margin: -.375em;
} }
/* Increase nav link tap target size a bit */
nav a {
padding: .125em;
}
/* Save some space and paper by making the site nav and footer
* links single-line, but bump up the line-height to increase
* space between tap-targets (a11y) */
header li,
footer li {
display: inline-block;
margin: .25em;
}
nav li { nav li {
line-height: 2; line-height: 2;
} }
/* Increase nav link tap target size a bit */
nav li a,
nav li a {
padding: .125em;
}
/* Save some space and paper by making the nav single-line, but bump
* up the line-height to increase space between tap-targets (a11y) */
header nav li,
footer nav li {
margin: .25em;
display: inline;
}
/* Lists without bullets: navlinks, posts lists, webmentions. /* Lists without bullets: navlinks, posts lists, webmentions.
* Those three are lists whose items are already easily distinguishable, * Those three are lists whose items are already easily
* rendering bullet points as unnecessary extra visual noise. Pretty * distinguishable, rendering bullet points as unnecessary extra
* much the only purely-aesthetic change in this CSS file. */ * visual noise. Pretty much the only purely-aesthetic change in this
* CSS file. */
.unstyled-list { .unstyled-list {
padding: 0; padding: 0;
} }
@ -219,6 +217,7 @@ img:not(.u-photo) {
* Also use "content-visibility: auto" to improve performance by * Also use "content-visibility: auto" to improve performance by
* reducing the number of DOM nodes rendered at once. */ * reducing the number of DOM nodes rendered at once. */
footer, footer,
section[aria-labelledby="webmentions"],
div[role="doc-endnotes"] { div[role="doc-endnotes"] {
border-top: 1px solid; border-top: 1px solid;
content-visibility: auto; content-visibility: auto;

View file

@ -6,7 +6,7 @@
span[aria-hidden], span[aria-hidden],
/* You can't navigate in a printout. */ /* You can't navigate in a printout. */
footer nav, footer nav,
header nav li a:not([aria-current]) { header nav a:not([rel="home"]) span {
display: none; display: none;
} }
} }

View file

@ -4,9 +4,11 @@
"@hint/hint-doctype": "^3.3.10", "@hint/hint-doctype": "^3.3.10",
"@hint/hint-https-only": "^2.4.10", "@hint/hint-https-only": "^2.4.10",
"@hint/hint-performance-budget": "^2.4.10", "@hint/hint-performance-budget": "^2.4.10",
"@lhci/cli": "^0.8.0",
"hint": "^6.1.4", "hint": "^6.1.4",
"stylelint": "^14.6.1", "stylelint": "^14.8.1",
"stylelint-config-standard": "^25.0.0" "stylelint-config-standard": "^25.0.0"
},
"dependencies": {
"stylelint-config-recommended": "^7.0.0"
} }
} }