176 web animation techniques, each a live demo with plain settings and a ready-made prompt for your AI assistant. No dependencies, no build step.
HTML ai-promptsanimationcss-animationsfrontendgithub-pagesjavascriptmicrointeractionsmotion-designno-dependenciesreferencescroll-animationui-animationweb-animationweb-developmentwebgl
fix: from 761px the note for the mode in view sits beside a short player bar, so it is on a laptop's first screen
matin0c6db0a79919
diff --git a/assets/css/demo-page.css b/assets/css/demo-page.cssindex 8cdd553a..11969169 100644--- a/assets/css/demo-page.css+++ b/assets/css/demo-page.css@@ -266,12 +266,24 @@ textarea.hb-text{min-height:88px;padding:10px 12px;resize:vertical}.hb-head:has(> .hb-lesson) > .hb-cat{grid-column:1}.hb-head:has(> .hb-lesson) > .hb-lesson{grid-column:2;justify-self:end;align-self:center}}-/* From 761px the mode switch sits at the right end of the Watch step's heading row */+/* From 761px the mode switch sits at the right end of the Watch step's heading row (two columns: the heading, the switch). A player+ bar with one or two controls leaves room beside it, so there the note for the mode in view sits next to the bar, under the switch,+ and is on a laptop's first screen too. Three columns then: the player bar's own width, the room left over and the switch's width.+ The heading spans the first two (the room it had before), the stage spans all three, the player bar keeps the start of its row (a+ note taller than the bar grows the row, not the bar, so the bar does not move) and the note spans the other two. A bar with a+ third control, or with the note that reduced motion adds, has no room to spare: it keeps the full row and the note stays under+ it. An empty notes box is taken out of the flow (above), so it takes no room here either. Up to 760px the note stays under the+ player bar. */@media(min-width:761px){.hb-watch:has(> .hb-modes){display:grid;grid-template-columns:minmax(0,1fr) auto;column-gap:20px;align-items:end}.hb-watch:has(> .hb-modes) > *{grid-column:1/-1}.hb-watch:has(> .hb-modes) > .hb-step-head{grid-column:1}.hb-watch:has(> .hb-modes) > .hb-modes{grid-column:2;flex-wrap:nowrap}+ .hb-watch:has(> .hb-modes):not(:has(> .hb-player > :nth-child(3))){grid-template-columns:auto minmax(0,1fr) auto}+ .hb-watch:has(> .hb-modes):not(:has(> .hb-player > :nth-child(3))) > .hb-step-head{grid-column:1/3}+ .hb-watch:has(> .hb-modes):not(:has(> .hb-player > :nth-child(3))) > .hb-modes{grid-column:3}+ .hb-watch:has(> .hb-modes):not(:has(> .hb-player > :nth-child(3))) > .hb-player{grid-column:1;align-self:start}+ .hb-watch:has(> .hb-modes):not(:has(> .hb-player > :nth-child(3))) > .hb-mode-notes{grid-column:2/-1;align-self:center}}/* Up to 760px the switch has a row of its own above the stage, its three buttons sharing it equally (.seg.hb-modes outranks the.seg button rule for phones further down) */diff --git a/tests/pages.test.js b/tests/pages.test.jsindex 0df186fb..7aba5ba6 100644--- a/tests/pages.test.js+++ b/tests/pages.test.js@@ -529,7 +529,7 @@ test('the shared stylesheet keeps choice buttons at least 44px wide', () => {assert.ok(rulesFor('.hb-page .seg button').some(rule => /(^|;)\s*min-width:\s*44px\s*(;|$)/.test(rule.body)), 'a choice button is at least 44px wide');});-test('the shared stylesheet draws the mode switch beside the Watch heading from 761px, hides an empty notes box, and styles the lesson line, the lesson nav and the idea lessons\' sections', () => {+test('the shared stylesheet draws the mode switch beside the Watch heading and the note beside a short player bar from 761px, hides an empty notes box, and styles the lesson line, the lesson nav and the idea lessons\' sections', () => {const css = read(path.join(ROOT, 'assets', 'css', 'demo-page.css'));const rules = cssRules(css);const has = sel => rules.some(r => r.selector.split(',').map(s => s.trim()).includes(sel));@@ -551,6 +551,23 @@ test('the shared stylesheet draws the mode switch beside the Watch heading fromassert.ok(rules.some(r => r.selector === '.hb-page .seg.hb-modes button' && /(^|;)\s*flex:\s*1 1 0\s*(;|$)/.test(r.body)),'up to 760px the three mode buttons share their row equally, outranking the phone rule for .seg buttons');assert.match(css, /@media\(min-width:761px\)\{\s*\.hb-watch:has\(> \.hb-modes\)\{display:grid/, 'from 761px the switch shares the heading row');+ // From 761px a player bar with one or two controls leaves room beside it, so the note for the mode in view sits next to the bar,+ // under the switch, and is on a laptop's first screen: three columns (the player bar's own width, the room left over, the switch's+ // width); the heading spans the first two, the player bar keeps the start of its row (a note taller than the bar grows the row,+ // not the bar, so the bar does not move) and the note spans the other two. A bar with a third control (or the note that reduced+ // motion adds) keeps the two columns, the full row and the note under it. Up to 760px the note stays under the player bar: no+ // other rule places it.+ const wide = between(css, '@media(min-width:761px){', '@media(max-width:760px)');+ const SHORT = '.hb-watch:has(> .hb-modes):not(:has(> .hb-player > :nth-child(3)))';+ for (const [what, text] of [+ ['three columns: the player bar, the room left over, the switch', `${SHORT}{grid-template-columns:auto minmax(0,1fr) auto}`],+ ['the heading spans the first two columns', `${SHORT} > .hb-step-head{grid-column:1/3}`],+ ['the switch is in the third column', `${SHORT} > .hb-modes{grid-column:3}`],+ ['the player bar starts its row and stays at the start of it when the row grows', `${SHORT} > .hb-player{grid-column:1;align-self:start}`],+ ['the note spans the other two columns', `${SHORT} > .hb-mode-notes{grid-column:2/-1;`],+ ['a bar with a third control keeps the two columns (the switch beside the heading, the rest on the full row)', '.hb-watch:has(> .hb-modes){display:grid;grid-template-columns:minmax(0,1fr) auto;']+ ]) assert.ok(wide.includes(text), `from 761px: ${what}`);+ assert.equal(count(css, '> .hb-mode-notes{'), 1, 'one rule places the note beside the player bar, and it is in the 761px block (phones keep the note under the bar)');assert.match(css, /@media\(min-width:601px\)\{\s*\.hb-head:has\(> \.hb-lesson\)\{display:grid/, 'from 601px the lesson line shares the category row');});