[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"verticals":3,"article-css-scroll-margin-top-anchor-offset":44,"path-membership-css-scroll-margin-top-anchor-offset":238,"search-suggestions":239,"related-css-scroll-margin-top-anchor-offset":279,"code:js:true:1xemq6g":405,"code:css:true:edkj6e":406,"code:css:true:1nqltur":407,"code:css:true:d4dtjc":408,"code:js:true:kcge0u":409,"comments-01a1df1b-36a8-772a-9e7a-3586a0ebff65":410},[4,20,32],{"id":5,"slug":6,"name":7,"tagline":8,"description":9,"accentFrom":10,"accentTo":11,"icon":12,"defaultLocale":13,"locales":14,"features":16,"position":19},"019fe637-3d33-714b-b57f-23e163ffca0c","dev","Web Development","Read it. Run it. Prove it.","A post a day on modern web development — most with an editable playground and a quiz that explains every answer. Free, no account needed.","violet-500","cyan-400","◇","en",[13,15],"fa",{"courses":17,"paths":17,"articles":17,"exams":18,"flashcards":18,"packages":17,"community":17,"certificates":17,"teams":17,"commerce":17},true,false,0,{"id":21,"slug":22,"name":23,"tagline":24,"description":25,"accentFrom":26,"accentTo":10,"icon":27,"defaultLocale":13,"locales":28,"features":30,"position":31},"019fe637-3dc2-754c-8657-0f175bfee7c6","lang","Languages","Learn a language the way you learn a codebase.","Grammar explained the way good documentation explains an API — one idea at a time, each with a quiz.","amber-400","⌘",[13,15,29],"es",{"courses":18,"paths":18,"articles":17,"exams":18,"flashcards":17,"packages":18,"community":17,"certificates":17,"teams":18,"commerce":18},2,{"id":33,"slug":34,"name":35,"tagline":36,"description":37,"accentFrom":38,"accentTo":39,"icon":40,"defaultLocale":13,"locales":41,"features":42,"position":43},"7b3c16f2-931d-410e-802e-e1fa4edab7de","soft","Soft Skills","The half of the job nobody wrote documentation for.","Weekly, on the parts of working life that decide more than your code does — first weeks, meetings, interviews, promotions, and the people around you. Written from what actually happens, and recorded as a podcast you can listen to on the walk.","emerald-400","teal-300","◉",[13],{"courses":18,"paths":18,"articles":17,"exams":18,"flashcards":18,"packages":18,"community":17,"certificates":18,"teams":18,"commerce":18},3,{"id":45,"slug":46,"title":47,"subtitle":48,"excerpt":49,"coverUrl":50,"locale":13,"readingMinutes":51,"publishedAt":52,"viewCount":53,"likeCount":19,"commentCount":19,"author":54,"vertical":59,"topic":60,"tags":63,"_count":75,"playground":77,"body":79,"bodyMd":220,"seo":221,"translationGroupId":225,"series":48,"podcastUrl":48,"verticalId":5,"thread":226,"assessments":228,"translations":234,"quiz":236},"01a1df1b-36a8-772a-9e7a-3586a0ebff65","css-scroll-margin-top-anchor-offset","Your Sticky Header Is Hiding Anchor Links. `scroll-margin-top` Fixes It.",null,"Clicking a table-of-contents link lands the heading right behind your sticky nav, half-hidden. The fix isn't a JavaScript scroll offset — it's one CSS property the browser already checks before it scrolls.","\u002Fmedia\u002Fcovers\u002Fcss-scroll-margin-top-anchor-offset.png",5,"2026-11-21T06:52:41.283Z",29,{"id":55,"name":56,"username":57,"avatarUrl":48,"headline":58},"019fe637-3c25-7088-9034-39c9f15dc3c8","Parsa Jiravand","parsa","Frontend engineer · building bestpractic",{"slug":6,"name":7,"accentFrom":10,"accentTo":11},{"slug":61,"name":62},"css","CSS",[64,66,69,72],{"slug":61,"name":65,"color":48},"Css",{"slug":67,"name":68,"color":48},"webdev","Webdev",{"slug":70,"name":71,"color":48},"frontend","Frontend",{"slug":73,"name":74,"color":48},"tutorial","Tutorial",{"assessments":76},1,{"slug":46,"title":78},"scroll-margin-top — interactive playground",{"blocks":80,"version":76},[81,85,88,93,96,102,105,108,115,118,122,125,128,132,135,138,141,145,148,151,154,157,160,163,167,170,174,178,181,184,187,190,193,196,199,202,205,208,211,214],{"id":82,"html":83,"type":84},"b1","\u003Cp>You redesign a docs page. Sticky header, clean table of contents down the side, the kind of polish that makes a demo look finished. Then someone clicks &quot;Installation&quot; in the TOC, and the page jumps — except the &quot;Installation&quot; heading is now sitting \u003Cem>behind\u003C\u002Fem> the header, top third clipped off, like the scroll stopped one beat too early.\u003C\u002Fp>","paragraph",{"id":86,"html":87,"type":84},"b2","\u003Cp>It&#39;s not a bug in your heading. It&#39;s not a bug in the TOC link. The browser scrolled exactly where you told it to. You just never told it about the header.\u003C\u002Fp>",{"id":89,"html":90,"text":91,"type":92,"level":31},"b3","The obvious fix that didn&#39;t quite work","The obvious fix that didn't quite work","heading",{"id":94,"html":95,"type":84},"b4","\u003Cp>The TOC links are plain anchors: \u003Ccode>&lt;a href=&quot;#installation&quot;&gt;\u003C\u002Fcode>. The browser handles the jump on its own — no JavaScript required, which is exactly why it feels like it shouldn&#39;t need any. So the first fix is the one that feels native to the problem: intercept the click, do the math yourself.\u003C\u002Fp>",{"id":97,"code":98,"type":99,"language":100,"highlight":101},"b5","document.querySelectorAll('a[href^=\"#\"]').forEach((link) => {\n  link.addEventListener(\"click\", (e) => {\n    e.preventDefault();\n    const id = link.getAttribute(\"href\").slice(1);\n    const target = document.getElementById(id);\n    const headerHeight = document.querySelector(\"header\").offsetHeight;\n    window.scrollTo({\n      top: target.getBoundingClientRect().top + window.scrollY - headerHeight - 16,\n      behavior: \"smooth\",\n    });\n  });\n});","code","js",[],{"id":103,"html":104,"type":84},"b6","\u003Cp>It works. Click a TOC link, the heading lands below the header, clean. Ship it, close the ticket.\u003C\u002Fp>",{"id":106,"html":107,"type":84},"b7","\u003Cp>Then QA files three more:\u003C\u002Fp>",{"id":109,"type":110,"items":111,"ordered":18},"b8","list",[112,113,114],"Deep-linking straight to \u003Ccode>yoursite.com\u002Fdocs#installation\u003C\u002Fcode> — no click ever fired — still lands the heading behind the header, because the hack only runs \u003Ccode>on click\u003C\u002Fcode>.","The browser&#39;s native back\u002Fforward button restores the old scroll position, not yours — hitting Back after a TOC click snaps right back behind the header.","Mobile ships a taller header. \u003Ccode>headerHeight\u003C\u002Fcode> was read once on load; resize the window and the offset is stale until a reload.",{"id":116,"html":117,"type":84},"b9","\u003Cp>Each of those is a separate bug with a separate fix — handle \u003Ccode>DOMContentLoaded\u003C\u002Fcode> for the deep-link case, listen for \u003Ccode>popstate\u003C\u002Fcode>, re-read \u003Ccode>offsetHeight\u003C\u002Fcode> on resize. You&#39;re not patching one bug anymore. You&#39;re reimplementing the browser&#39;s own &quot;scroll to this element&quot; logic, one missed case at a time, in a \u003Ccode>&lt;script&gt;\u003C\u002Fcode> tag.\u003C\u002Fp>",{"id":119,"html":120,"text":121,"type":92,"level":31},"b10","The browser already asks &quot;how much space do you need&quot;","The browser already asks \"how much space do you need\"",{"id":123,"html":124,"type":84},"b11","\u003Cp>Fragment navigation, \u003Ccode>Element.scrollIntoView()\u003C\u002Fcode>, and the browser scrolling a focused element into view as you tab through the page all go through the same question: \u003Cem>what counts as &quot;this element is now in view&quot;?\u003C\u002Fem> Since 2021, every major browser has agreed on an answer CSS checks before any of them run — \u003Ccode>scroll-margin-top\u003C\u002Fcode> and its counterpart, \u003Ccode>scroll-padding-top\u003C\u002Fcode>.\u003C\u002Fp>",{"id":126,"html":127,"type":84},"b12","\u003Cp>Put it on the headings themselves:\u003C\u002Fp>",{"id":129,"code":130,"type":99,"language":61,"highlight":131},"b13","h2,\nh3 {\n  scroll-margin-top: 4.5rem; \u002F* roughly the header's height, plus breathing room *\u002F\n}",[],{"id":133,"html":134,"type":84},"b14","\u003Cp>That&#39;s it. No click handler, no \u003Ccode>preventDefault()\u003C\u002Fcode>, no recomputed pixel offset. Click a TOC link, hit the browser&#39;s native back button, paste a \u003Ccode>#installation\u003C\u002Fcode> link straight into the address bar — every path the browser uses to bring that heading into view now stops 4.5rem early, because the browser itself is doing the arithmetic, the same way it always has.\u003C\u002Fp>",{"id":136,"html":137,"text":137,"type":92,"level":31},"b15","Per-heading vs. whole-page: pick the one that matches the bug",{"id":139,"html":140,"type":84},"b16","\u003Cp>\u003Ccode>scroll-margin-top\u003C\u002Fcode> goes on the \u003Cstrong>target\u003C\u002Fstrong> — the thing being scrolled to. \u003Ccode>scroll-padding-top\u003C\u002Fcode> goes on the \u003Cstrong>scroll container\u003C\u002Fstrong> — usually \u003Ccode>html\u003C\u002Fcode>, or whatever element actually scrolls — and applies the same offset to every target inside it, without touching each heading individually:\u003C\u002Fp>",{"id":142,"code":143,"type":99,"language":61,"highlight":144},"b17","html {\n  scroll-padding-top: 4.5rem; \u002F* one declaration, covers every #anchor on the site *\u002F\n}",[],{"id":146,"html":147,"type":84},"b18","\u003Cp>If every page on the site sits under the same sticky header, \u003Ccode>scroll-padding-top\u003C\u002Fcode> on \u003Ccode>html\u003C\u002Fcode> is the one-line, whole-site fix — set it once, forget it. Reach for \u003Ccode>scroll-margin-top\u003C\u002Fcode> on specific elements instead when different targets need different offsets: a shorter mobile header, a taller &quot;in-page alert&quot; banner above certain sections, or a card in a horizontally-scrolling carousel that needs its own left-edge margin rather than a top one.\u003C\u002Fp>",{"id":149,"html":150,"type":84},"b19","\u003C!-- playground:start -->",{"id":152,"html":153,"text":153,"type":92,"level":31},"b20","🎮 Try it yourself",{"id":155,"html":156,"type":84},"b21","\u003Cp>\u003Cstrong>\u003Ca href=\"https:\u002F\u002Fbestpractic.org\u002Fblog\u002Fcss-scroll-margin-top-anchor-offset\u002Fplayground\">▶️ Open the interactive playground →\u003C\u002Fa>\u003C\u002Fstrong>\u003C\u002Fp>",{"id":158,"html":159,"type":84},"b22","\u003Cp>\u003Cem>Runs right in your browser — poke at it and watch the concept react live.\u003C\u002Fem>\u003C\u002Fp>",{"id":161,"html":162,"type":84},"b23","\u003C!-- playground:end -->",{"id":164,"html":165,"text":166,"type":92,"level":31},"b24","Stop hardcoding the header&#39;s height as a magic number","Stop hardcoding the header's height as a magic number",{"id":168,"html":169,"type":84},"b25","\u003Cp>\u003Ccode>4.5rem\u003C\u002Fcode> is a guess that goes stale the day someone adds a banner to the header. Read the header&#39;s real height instead, and feed it in as a custom property:\u003C\u002Fp>",{"id":171,"code":172,"type":99,"language":61,"highlight":173},"b26",":root {\n  --header-h: 64px; \u002F* kept in sync with the header's actual rendered height *\u002F\n}\n\nh2,\nh3 {\n  scroll-margin-top: calc(var(--header-h) + 16px);\n}",[],{"id":175,"code":176,"type":99,"language":100,"highlight":177},"b27","const header = document.querySelector(\"header\");\nconst setHeaderHeight = () =>\n  document.documentElement.style.setProperty(\"--header-h\", `${header.offsetHeight}px`);\n\nsetHeaderHeight();\nnew ResizeObserver(setHeaderHeight).observe(header);",[],{"id":179,"html":180,"type":84},"b28","\u003Cp>Now the only JavaScript left is measuring the header — not re-deriving the browser&#39;s entire scroll-to-element behavior. If the header grows a second row on mobile, \u003Ccode>ResizeObserver\u003C\u002Fcode> catches it and the custom property updates; \u003Ccode>scroll-margin-top\u003C\u002Fcode> reads the new value on the next scroll. The division of labor is the point: JavaScript&#39;s job shrinks to &quot;report one number,&quot; and CSS&#39;s job — &quot;stop scrolling here&quot; — stays where the browser already does it for free.\u003C\u002Fp>",{"id":182,"html":183,"text":183,"type":92,"level":31},"b29","Where this still needs a human",{"id":185,"html":186,"type":84},"b30","\u003Cp>\u003Ccode>scroll-margin-top\u003C\u002Fcode> fixes where the page \u003Cem>lands\u003C\u002Fem>. It doesn&#39;t fix a heading that&#39;s visually ambiguous about whether it&#39;s &quot;the current section&quot; once it&#39;s sitting right under the header edge — that&#39;s a design question about header contrast and spacing, not a CSS-property question. And if your TOC also needs to highlight the \u003Cem>active\u003C\u002Fem> section as the reader scrolls, that&#39;s a separate job (usually \u003Ccode>IntersectionObserver\u003C\u002Fcode>), not something \u003Ccode>scroll-margin-top\u003C\u002Fcode> does for you. It solves exactly one problem — stopping short of the header — and it&#39;s worth not asking it to solve the other two.\u003C\u002Fp>",{"id":188,"html":189,"type":84},"b31","\u003C!-- quiz:start -->",{"id":191,"html":192,"text":192,"type":92,"level":31},"b32","🧠 Test yourself",{"id":194,"html":195,"type":84},"b33","\u003Cp>Think it clicked? \u003Cstrong>\u003Ca href=\"https:\u002F\u002Fbestpractic.org\u002Fblog\u002Fcss-scroll-margin-top-anchor-offset\u002Fquiz\">Take the 7-question quiz →\u003C\u002Fa>\u003C\u002Fstrong>\u003C\u002Fp>",{"id":197,"html":198,"type":84},"b34","\u003Cp>\u003Cem>Instant feedback, a hint on every question, and an explanation for each answer — right or wrong.\u003C\u002Fem>\u003C\u002Fp>",{"id":200,"html":201,"type":84},"b35","\u003C!-- quiz:end -->",{"id":203,"html":204,"type":84},"b36","\u003Cp>The bug report wasn&#39;t &quot;the table of contents is broken.&quot; It was &quot;the browser doesn&#39;t know about your header&quot; — and it turns out the browser was willing to be told, in CSS, for free, since before most of us noticed. Got a scroll offset hack sitting in a \u003Ccode>click\u003C\u002Fcode> handler somewhere? Go check what it&#39;s actually compensating for — there&#39;s a decent chance one property replaces it.\u003C\u002Fp>",{"id":206,"type":207},"b37","divider",{"id":209,"html":210,"type":84},"b38","\u003Cp>🚀 \u003Cstrong>Want more like this?\u003C\u002Fstrong> Every guide, playground, and quiz lives on \u003Cstrong>\u003Ca href=\"https:\u002F\u002Fbestpractic.org\u002F\">bestpractic.org\u003C\u002Fa>\u003C\u002Fstrong> — open it and \u003Cstrong>\u003Ca href=\"https:\u002F\u002Fbestpractic.org\u002F\">sign up free\u003C\u002Fa>\u003C\u002Fstrong> so the next one finds you.\u003C\u002Fp>",{"id":212,"html":213,"type":84},"b39","\u003Cp>\u003Cem>Thanks for reading! Let&#39;s stay connected:\u003C\u002Fem>\u003C\u002Fp>",{"id":215,"type":110,"items":216,"ordered":18},"b40",[217,218,219],"⭐ \u003Cstrong>GitHub\u003C\u002Fstrong> — follow me and star the projects: \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fparsajiravand\">github.com\u002Fparsajiravand\u003C\u002Fa>","💬 \u003Cstrong>Discord\u003C\u002Fstrong> — join the frontend best-practices community: \u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002Fd9KRhuAwQ\">discord.gg\u002Fd9KRhuAwQ\u003C\u002Fa>","📸 \u003Cstrong>Instagram\u003C\u002Fstrong> — frontend best practices, daily: \u003Ca href=\"https:\u002F\u002Fwww.instagram.com\u002Fbestpractice___\u002F\">@bestpractice___\u003C\u002Fa>","You redesign a docs page. Sticky header, clean table of contents down the side, the kind of polish that makes a demo look finished. Then someone clicks \"Installation\" in the TOC, and the page jumps — except the \"Installation\" heading is now sitting *behind* the header, top third clipped off, like the scroll stopped one beat too early.\n\nIt's not a bug in your heading. It's not a bug in the TOC link. The browser scrolled exactly where you told it to. You just never told it about the header.\n\n## The obvious fix that didn't quite work\n\nThe TOC links are plain anchors: `\u003Ca href=\"#installation\">`. The browser handles the jump on its own — no JavaScript required, which is exactly why it feels like it shouldn't need any. So the first fix is the one that feels native to the problem: intercept the click, do the math yourself.\n\n```js\ndocument.querySelectorAll('a[href^=\"#\"]').forEach((link) => {\n  link.addEventListener(\"click\", (e) => {\n    e.preventDefault();\n    const id = link.getAttribute(\"href\").slice(1);\n    const target = document.getElementById(id);\n    const headerHeight = document.querySelector(\"header\").offsetHeight;\n    window.scrollTo({\n      top: target.getBoundingClientRect().top + window.scrollY - headerHeight - 16,\n      behavior: \"smooth\",\n    });\n  });\n});\n```\n\nIt works. Click a TOC link, the heading lands below the header, clean. Ship it, close the ticket.\n\nThen QA files three more:\n\n- Deep-linking straight to `yoursite.com\u002Fdocs#installation` — no click ever fired — still lands the heading behind the header, because the hack only runs `on click`.\n- The browser's native back\u002Fforward button restores the old scroll position, not yours — hitting Back after a TOC click snaps right back behind the header.\n- Mobile ships a taller header. `headerHeight` was read once on load; resize the window and the offset is stale until a reload.\n\nEach of those is a separate bug with a separate fix — handle `DOMContentLoaded` for the deep-link case, listen for `popstate`, re-read `offsetHeight` on resize. You're not patching one bug anymore. You're reimplementing the browser's own \"scroll to this element\" logic, one missed case at a time, in a `\u003Cscript>` tag.\n\n## The browser already asks \"how much space do you need\"\n\nFragment navigation, `Element.scrollIntoView()`, and the browser scrolling a focused element into view as you tab through the page all go through the same question: *what counts as \"this element is now in view\"?* Since 2021, every major browser has agreed on an answer CSS checks before any of them run — `scroll-margin-top` and its counterpart, `scroll-padding-top`.\n\nPut it on the headings themselves:\n\n```css\nh2,\nh3 {\n  scroll-margin-top: 4.5rem; \u002F* roughly the header's height, plus breathing room *\u002F\n}\n```\n\nThat's it. No click handler, no `preventDefault()`, no recomputed pixel offset. Click a TOC link, hit the browser's native back button, paste a `#installation` link straight into the address bar — every path the browser uses to bring that heading into view now stops 4.5rem early, because the browser itself is doing the arithmetic, the same way it always has.\n\n## Per-heading vs. whole-page: pick the one that matches the bug\n\n`scroll-margin-top` goes on the **target** — the thing being scrolled to. `scroll-padding-top` goes on the **scroll container** — usually `html`, or whatever element actually scrolls — and applies the same offset to every target inside it, without touching each heading individually:\n\n```css\nhtml {\n  scroll-padding-top: 4.5rem; \u002F* one declaration, covers every #anchor on the site *\u002F\n}\n```\n\nIf every page on the site sits under the same sticky header, `scroll-padding-top` on `html` is the one-line, whole-site fix — set it once, forget it. Reach for `scroll-margin-top` on specific elements instead when different targets need different offsets: a shorter mobile header, a taller \"in-page alert\" banner above certain sections, or a card in a horizontally-scrolling carousel that needs its own left-edge margin rather than a top one.\n\n\u003C!-- playground:start -->\n\n## 🎮 Try it yourself\n\n**[▶️ Open the interactive playground →](https:\u002F\u002Fbestpractic.org\u002Fblog\u002Fcss-scroll-margin-top-anchor-offset\u002Fplayground)**\n\n_Runs right in your browser — poke at it and watch the concept react live._\n\n\u003C!-- playground:end -->\n\n## Stop hardcoding the header's height as a magic number\n\n`4.5rem` is a guess that goes stale the day someone adds a banner to the header. Read the header's real height instead, and feed it in as a custom property:\n\n```css\n:root {\n  --header-h: 64px; \u002F* kept in sync with the header's actual rendered height *\u002F\n}\n\nh2,\nh3 {\n  scroll-margin-top: calc(var(--header-h) + 16px);\n}\n```\n\n```js\nconst header = document.querySelector(\"header\");\nconst setHeaderHeight = () =>\n  document.documentElement.style.setProperty(\"--header-h\", `${header.offsetHeight}px`);\n\nsetHeaderHeight();\nnew ResizeObserver(setHeaderHeight).observe(header);\n```\n\nNow the only JavaScript left is measuring the header — not re-deriving the browser's entire scroll-to-element behavior. If the header grows a second row on mobile, `ResizeObserver` catches it and the custom property updates; `scroll-margin-top` reads the new value on the next scroll. The division of labor is the point: JavaScript's job shrinks to \"report one number,\" and CSS's job — \"stop scrolling here\" — stays where the browser already does it for free.\n\n## Where this still needs a human\n\n`scroll-margin-top` fixes where the page *lands*. It doesn't fix a heading that's visually ambiguous about whether it's \"the current section\" once it's sitting right under the header edge — that's a design question about header contrast and spacing, not a CSS-property question. And if your TOC also needs to highlight the *active* section as the reader scrolls, that's a separate job (usually `IntersectionObserver`), not something `scroll-margin-top` does for you. It solves exactly one problem — stopping short of the header — and it's worth not asking it to solve the other two.\n\n\u003C!-- quiz:start -->\n\n## 🧠 Test yourself\n\nThink it clicked? **[Take the 7-question quiz →](https:\u002F\u002Fbestpractic.org\u002Fblog\u002Fcss-scroll-margin-top-anchor-offset\u002Fquiz)**\n\n_Instant feedback, a hint on every question, and an explanation for each answer — right or wrong._\n\n\u003C!-- quiz:end -->\n\nThe bug report wasn't \"the table of contents is broken.\" It was \"the browser doesn't know about your header\" — and it turns out the browser was willing to be told, in CSS, for free, since before most of us noticed. Got a scroll offset hack sitting in a `click` handler somewhere? Go check what it's actually compensating for — there's a decent chance one property replaces it.\n\n---\n\n🚀 **Want more like this?** Every guide, playground, and quiz lives on **[bestpractic.org](https:\u002F\u002Fbestpractic.org\u002F)** — open it and **[sign up free](https:\u002F\u002Fbestpractic.org\u002F)** so the next one finds you.\n\n*Thanks for reading! Let's stay connected:*\n\n- ⭐ **GitHub** — follow me and star the projects: [github.com\u002Fparsajiravand](https:\u002F\u002Fgithub.com\u002Fparsajiravand)\n- 💬 **Discord** — join the frontend best-practices community: [discord.gg\u002Fd9KRhuAwQ](https:\u002F\u002Fdiscord.gg\u002Fd9KRhuAwQ)\n- 📸 **Instagram** — frontend best practices, daily: [@bestpractice___](https:\u002F\u002Fwww.instagram.com\u002Fbestpractice___\u002F)",{"title":222,"canonical":223,"description":224},"Your Sticky Header Is Hiding Anchor Links. `scroll-margin-top` Fixes I","https:\u002F\u002Fbestpractic.org\u002Fblog\u002Fcss-scroll-margin-top-anchor-offset","Clicking a table-of-contents link lands the heading right behind your sticky nav, half-hidden. The fix isn't a JavaScript scroll offset — it's one CSS property the browser already ","01a1df1b-36a8-772a-9e7a-3a0dbfcb434d",{"id":227,"locked":18},"01a1df1b-3742-7327-9820-8bc3a02db8e6",[229],{"id":230,"slug":46,"title":231,"_count":232},"01a1df1b-3774-73d0-92cf-8c4abf29b98a","Test yourself — scroll-margin-top",{"questions":233},7,[235],{"locale":13,"slug":46},{"id":230,"slug":46,"title":231,"_count":237,"questionCount":233},{"questions":233},[],[240,242,246,248,250,252,256,260,264,267,271,275],{"slug":67,"name":68,"articles":241},178,{"slug":243,"name":244,"articles":245},"javascript","Javascript",142,{"slug":70,"name":71,"articles":247},99,{"slug":73,"name":74,"articles":249},74,{"slug":61,"name":65,"articles":251},54,{"slug":253,"name":254,"articles":255},"performance","Performance",31,{"slug":257,"name":258,"articles":259},"typescript","Typescript",26,{"slug":261,"name":262,"articles":263},"react","React",20,{"slug":265,"name":266,"articles":263},"programming","Programming",{"slug":268,"name":269,"articles":270},"browser","Browser",18,{"slug":272,"name":273,"articles":274},"node","Node",17,{"slug":276,"name":277,"articles":278},"html","Html",12,{"items":280,"meta":403},[281,293,312,331,349,367,385],{"id":45,"slug":46,"title":47,"subtitle":48,"excerpt":49,"coverUrl":50,"locale":13,"readingMinutes":51,"publishedAt":52,"viewCount":282,"likeCount":19,"commentCount":19,"author":283,"vertical":284,"topic":285,"tags":286,"_count":291,"playground":292,"hasQuiz":17,"hasPlayground":17},30,{"id":55,"name":56,"username":57,"avatarUrl":48,"headline":58},{"slug":6,"name":7,"accentFrom":10,"accentTo":11},{"slug":61,"name":62},[287,288,289,290],{"slug":61,"name":65,"color":48},{"slug":67,"name":68,"color":48},{"slug":70,"name":71,"color":48},{"slug":73,"name":74,"color":48},{"assessments":76},{"slug":46},{"id":294,"slug":295,"title":296,"subtitle":48,"excerpt":297,"coverUrl":298,"locale":13,"readingMinutes":299,"publishedAt":300,"viewCount":301,"likeCount":19,"commentCount":19,"author":302,"vertical":303,"topic":304,"tags":305,"_count":310,"playground":311,"hasQuiz":17,"hasPlayground":17},"01a1af7a-c595-77be-8e0a-dea27ce0db13","variable-fonts-one-file-many-weights","I Was Shipping Five Font Files. One Variable Font Replaced Them All.","Regular, Medium, Semibold, Bold, Bold Italic — five @font-face blocks, five network requests, just to render a design system's type scale. A single variable font file replaces all of them, and it's been supported everywhere since 2018.","\u002Fmedia\u002Fcovers\u002Fvariable-fonts-one-file-many-weights.png",6,"2026-11-15T12:10:51.143Z",277,{"id":55,"name":56,"username":57,"avatarUrl":48,"headline":58},{"slug":6,"name":7,"accentFrom":10,"accentTo":11},{"slug":61,"name":62},[306,307,308,309],{"slug":61,"name":65,"color":48},{"slug":67,"name":68,"color":48},{"slug":70,"name":71,"color":48},{"slug":253,"name":254,"color":48},{"assessments":76},{"slug":295},{"id":313,"slug":314,"title":315,"subtitle":48,"excerpt":316,"coverUrl":317,"locale":13,"readingMinutes":318,"publishedAt":319,"viewCount":320,"likeCount":19,"commentCount":19,"author":321,"vertical":322,"topic":323,"tags":324,"_count":329,"playground":330,"hasQuiz":17,"hasPlayground":17},"01a1c0f9-dcbd-71ce-acad-1012bf44027c","overflow-clip-vs-overflow-hidden-sticky","overflow: hidden breaks position: sticky. overflow: clip doesn't.","A sticky header that worked in isolation stops sticking the moment it's dropped inside a rounded-corner card with overflow: hidden. The card isn't scrollable — but the browser doesn't care. overflow: clip is the fix, and it's been quietly ready for a while.","\u002Fmedia\u002Fcovers\u002Foverflow-clip-vs-overflow-hidden-sticky.png",4,"2026-11-15T12:07:47.081Z",236,{"id":55,"name":56,"username":57,"avatarUrl":48,"headline":58},{"slug":6,"name":7,"accentFrom":10,"accentTo":11},{"slug":61,"name":62},[325,326,327,328],{"slug":61,"name":65,"color":48},{"slug":67,"name":68,"color":48},{"slug":70,"name":71,"color":48},{"slug":73,"name":74,"color":48},{"assessments":76},{"slug":314},{"id":332,"slug":333,"title":334,"subtitle":48,"excerpt":335,"coverUrl":336,"locale":13,"readingMinutes":299,"publishedAt":337,"viewCount":338,"likeCount":19,"commentCount":19,"author":339,"vertical":340,"topic":341,"tags":342,"_count":347,"playground":348,"hasQuiz":17,"hasPlayground":17},"01a1a007-b7cf-743d-a21f-35adebf60420","prefers-color-scheme-theme-flash","Stop Blaming `prefers-color-scheme` For Your Theme Flash","Your dark mode toggle flashes light for a frame on every reload — but prefers-color-scheme alone never does that. The real bug is where your theme script runs relative to the browser's first paint.","\u002Fmedia\u002Fcovers\u002Fprefers-color-scheme-theme-flash.png","2026-11-09T15:42:44.790Z",404,{"id":55,"name":56,"username":57,"avatarUrl":48,"headline":58},{"slug":6,"name":7,"accentFrom":10,"accentTo":11},{"slug":61,"name":62},[343,344,345,346],{"slug":61,"name":65,"color":48},{"slug":243,"name":244,"color":48},{"slug":67,"name":68,"color":48},{"slug":70,"name":71,"color":48},{"assessments":76},{"slug":333},{"id":350,"slug":351,"title":352,"subtitle":48,"excerpt":353,"coverUrl":354,"locale":13,"readingMinutes":299,"publishedAt":355,"viewCount":356,"likeCount":19,"commentCount":19,"author":357,"vertical":358,"topic":359,"tags":360,"_count":365,"playground":366,"hasQuiz":17,"hasPlayground":17},"01a17bfb-4a13-77fa-bb6c-5c654aec4dd7","scrollbar-gutter-layout-shift","I Deleted My Scroll-Lock Library's Ugly Hack. `scrollbar-gutter` Replaces It.","Opening a modal shifts your whole page sideways because the scrollbar vanishes with it — the bug every scroll-lock library papers over with a JS width measurement and a padding-right hack. `scrollbar-gutter: stable` fixes it in one line now that Safari finally caught up.","\u002Fmedia\u002Fcovers\u002Fscrollbar-gutter-layout-shift.png","2026-11-02T05:31:34.059Z",461,{"id":55,"name":56,"username":57,"avatarUrl":48,"headline":58},{"slug":6,"name":7,"accentFrom":10,"accentTo":11},{"slug":61,"name":62},[361,362,363,364],{"slug":61,"name":65,"color":48},{"slug":67,"name":68,"color":48},{"slug":70,"name":71,"color":48},{"slug":243,"name":244,"color":48},{"assessments":76},{"slug":351},{"id":368,"slug":369,"title":370,"subtitle":48,"excerpt":371,"coverUrl":372,"locale":13,"readingMinutes":233,"publishedAt":373,"viewCount":374,"likeCount":19,"commentCount":19,"author":375,"vertical":376,"topic":377,"tags":378,"_count":383,"playground":384,"hasQuiz":17,"hasPlayground":17},"01a176b8-6fee-705e-9118-a40e4feb9312","css-relative-color-syntax","Stop Hardcoding Color Variants. Relative Color Syntax Does It.","A design system ships one brand color and four hand-picked hex variants for hover, pressed, border, and tint. Change the brand color and four of those five silently go stale. CSS relative color syntax derives every variant from the one color you actually update.","\u002Fmedia\u002Fcovers\u002Fcss-relative-color-syntax.png","2026-11-01T14:51:27.260Z",364,{"id":55,"name":56,"username":57,"avatarUrl":48,"headline":58},{"slug":6,"name":7,"accentFrom":10,"accentTo":11},{"slug":61,"name":62},[379,380,381,382],{"slug":61,"name":65,"color":48},{"slug":67,"name":68,"color":48},{"slug":70,"name":71,"color":48},{"slug":265,"name":266,"color":48},{"assessments":76},{"slug":369},{"id":386,"slug":387,"title":388,"subtitle":48,"excerpt":389,"coverUrl":390,"locale":13,"readingMinutes":299,"publishedAt":391,"viewCount":392,"likeCount":19,"commentCount":19,"author":393,"vertical":394,"topic":395,"tags":396,"_count":401,"playground":402,"hasQuiz":17,"hasPlayground":17},"01a1749f-27d5-773f-8c09-13beb3128da0","css-grid-lanes-native-masonry-layout","Stop Using a JS Masonry Library. CSS Grid Lanes Does It Natively.","Masonry layouts have meant a JS library or a CSS column-count hack that scrambles reading order ever since Pinterest made the look popular. CSS Grid Lanes finally does it natively — here's the real support story and how to ship it today.","\u002Fmedia\u002Fcovers\u002Fcss-grid-lanes-native-masonry-layout.png","2026-10-30T05:36:15.418Z",474,{"id":55,"name":56,"username":57,"avatarUrl":48,"headline":58},{"slug":6,"name":7,"accentFrom":10,"accentTo":11},{"slug":61,"name":62},[397,398,399,400],{"slug":61,"name":65,"color":48},{"slug":67,"name":68,"color":48},{"slug":70,"name":71,"color":48},{"slug":73,"name":74,"color":48},{"assessments":76},{"slug":387},{"page":76,"perPage":233,"total":251,"totalPages":404},8,"\u003Cdiv class=\"shj shj-lang-js shj-multiline\" data-lang=\"js\">\u003Cdiv class=\"shj-scroll\">\u003Cdiv class=\"shj-numbers\">\u003Cdiv>1\u003C\u002Fdiv>\u003Cdiv>2\u003C\u002Fdiv>\u003Cdiv>3\u003C\u002Fdiv>\u003Cdiv>4\u003C\u002Fdiv>\u003Cdiv>5\u003C\u002Fdiv>\u003Cdiv>6\u003C\u002Fdiv>\u003Cdiv>7\u003C\u002Fdiv>\u003Cdiv>8\u003C\u002Fdiv>\u003Cdiv>9\u003C\u002Fdiv>\u003Cdiv>10\u003C\u002Fdiv>\u003Cdiv>11\u003C\u002Fdiv>\u003Cdiv>12\u003C\u002Fdiv>\u003C\u002Fdiv>\u003Cdiv class=\"shj-code\">document\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>\u003Cspan class=\"shj-func\">querySelectorAll\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>\u003Cspan class=\"shj-str\">'a[href^=\"#\"]'\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>\u003Cspan class=\"shj-func\">forEach\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>link\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan> \u003Cspan class=\"shj-kwd\">=&gt;\u003C\u002Fspan> \u003Cspan class=\"shj-bracket\">{\u003C\u002Fspan>\n  link\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>\u003Cspan class=\"shj-func\">addEventListener\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>\u003Cspan class=\"shj-str\">\"click\"\u003C\u002Fspan>\u003Cspan class=\"shj-oper\">,\u003C\u002Fspan> \u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>e\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan> \u003Cspan class=\"shj-kwd\">=&gt;\u003C\u002Fspan> \u003Cspan class=\"shj-bracket\">{\u003C\u002Fspan>\n    e\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>\u003Cspan class=\"shj-func\">preventDefault\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>;\n    \u003Cspan class=\"shj-kwd\">const\u003C\u002Fspan> id \u003Cspan class=\"shj-oper\">=\u003C\u002Fspan> link\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>\u003Cspan class=\"shj-func\">getAttribute\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>\u003Cspan class=\"shj-str\">\"href\"\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>\u003Cspan class=\"shj-func\">slice\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>\u003Cspan class=\"shj-num\">1\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>;\n    \u003Cspan class=\"shj-kwd\">const\u003C\u002Fspan> target \u003Cspan class=\"shj-oper\">=\u003C\u002Fspan> document\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>\u003Cspan class=\"shj-func\">getElementById\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>id\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>;\n    \u003Cspan class=\"shj-kwd\">const\u003C\u002Fspan> headerHeight \u003Cspan class=\"shj-oper\">=\u003C\u002Fspan> document\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>\u003Cspan class=\"shj-func\">querySelector\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>\u003Cspan class=\"shj-str\">\"header\"\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>offsetHeight;\n    window\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>\u003Cspan class=\"shj-func\">scrollTo\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">{\u003C\u002Fspan>\n      top\u003Cspan class=\"shj-oper\">:\u003C\u002Fspan> target\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>\u003Cspan class=\"shj-func\">getBoundingClientRect\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>top \u003Cspan class=\"shj-oper\">+\u003C\u002Fspan> window\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>scrollY \u003Cspan class=\"shj-oper\">-\u003C\u002Fspan> headerHeight \u003Cspan class=\"shj-oper\">-\u003C\u002Fspan> \u003Cspan class=\"shj-num\">16\u003C\u002Fspan>\u003Cspan class=\"shj-oper\">,\u003C\u002Fspan>\n      behavior\u003Cspan class=\"shj-oper\">:\u003C\u002Fspan> \u003Cspan class=\"shj-str\">\"smooth\"\u003C\u002Fspan>\u003Cspan class=\"shj-oper\">,\u003C\u002Fspan>\n    \u003Cspan class=\"shj-bracket\">}\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>;\n  \u003Cspan class=\"shj-bracket\">}\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>;\n\u003Cspan class=\"shj-bracket\">}\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>;\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>","\u003Cdiv class=\"shj shj-lang-css shj-multiline\" data-lang=\"css\">\u003Cdiv class=\"shj-scroll\">\u003Cdiv class=\"shj-numbers\">\u003Cdiv>1\u003C\u002Fdiv>\u003Cdiv>2\u003C\u002Fdiv>\u003Cdiv>3\u003C\u002Fdiv>\u003Cdiv>4\u003C\u002Fdiv>\u003C\u002Fdiv>\u003Cdiv class=\"shj-code\">\u003Cspan class=\"shj-kwd\">h\u003C\u002Fspan>\u003Cspan class=\"shj-num\">2\u003C\u002Fspan>,\n\u003Cspan class=\"shj-kwd\">h\u003C\u002Fspan>\u003Cspan class=\"shj-num\">3\u003C\u002Fspan> \u003Cspan class=\"shj-bracket\">{\u003C\u002Fspan>\n  \u003Cspan class=\"shj-var\">scroll-margin-top\u003C\u002Fspan>: \u003Cspan class=\"shj-num\">4.5\u003C\u002Fspan>\u003Cspan class=\"shj-var\">rem\u003C\u002Fspan>\u003Cspan class=\"shj-num\">\u003C\u002Fspan>; \u003Cspan class=\"shj-cmnt\">\u002F* roughly the header's height, plus breathing room *\u002F\u003C\u002Fspan>\n\u003Cspan class=\"shj-bracket\">}\u003C\u002Fspan>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>","\u003Cdiv class=\"shj shj-lang-css shj-multiline\" data-lang=\"css\">\u003Cdiv class=\"shj-scroll\">\u003Cdiv class=\"shj-numbers\">\u003Cdiv>1\u003C\u002Fdiv>\u003Cdiv>2\u003C\u002Fdiv>\u003Cdiv>3\u003C\u002Fdiv>\u003C\u002Fdiv>\u003Cdiv class=\"shj-code\">\u003Cspan class=\"shj-kwd\">html\u003C\u002Fspan> \u003Cspan class=\"shj-bracket\">{\u003C\u002Fspan>\n  \u003Cspan class=\"shj-var\">scroll-padding-top\u003C\u002Fspan>: \u003Cspan class=\"shj-num\">4.5\u003C\u002Fspan>\u003Cspan class=\"shj-var\">rem\u003C\u002Fspan>\u003Cspan class=\"shj-num\">\u003C\u002Fspan>; \u003Cspan class=\"shj-cmnt\">\u002F* one declaration, covers every #anchor on the site *\u002F\u003C\u002Fspan>\n\u003Cspan class=\"shj-bracket\">}\u003C\u002Fspan>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>","\u003Cdiv class=\"shj shj-lang-css shj-multiline\" data-lang=\"css\">\u003Cdiv class=\"shj-scroll\">\u003Cdiv class=\"shj-numbers\">\u003Cdiv>1\u003C\u002Fdiv>\u003Cdiv>2\u003C\u002Fdiv>\u003Cdiv>3\u003C\u002Fdiv>\u003Cdiv>4\u003C\u002Fdiv>\u003Cdiv>5\u003C\u002Fdiv>\u003Cdiv>6\u003C\u002Fdiv>\u003Cdiv>7\u003C\u002Fdiv>\u003Cdiv>8\u003C\u002Fdiv>\u003C\u002Fdiv>\u003Cdiv class=\"shj-code\">\u003Cspan class=\"shj-var\">:root\u003C\u002Fspan> \u003Cspan class=\"shj-bracket\">{\u003C\u002Fspan>\n  --\u003Cspan class=\"shj-var\">header-h\u003C\u002Fspan>: \u003Cspan class=\"shj-num\">64\u003C\u002Fspan>\u003Cspan class=\"shj-var\">px\u003C\u002Fspan>\u003Cspan class=\"shj-num\">\u003C\u002Fspan>; \u003Cspan class=\"shj-cmnt\">\u002F* kept in sync with the header's actual rendered height *\u002F\u003C\u002Fspan>\n\u003Cspan class=\"shj-bracket\">}\u003C\u002Fspan>\n\n\u003Cspan class=\"shj-kwd\">h\u003C\u002Fspan>\u003Cspan class=\"shj-num\">2\u003C\u002Fspan>,\n\u003Cspan class=\"shj-kwd\">h\u003C\u002Fspan>\u003Cspan class=\"shj-num\">3\u003C\u002Fspan> \u003Cspan class=\"shj-bracket\">{\u003C\u002Fspan>\n  \u003Cspan class=\"shj-var\">scroll-margin-top\u003C\u002Fspan>: \u003Cspan class=\"shj-func\">calc\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>\u003Cspan class=\"shj-func\">var\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>--\u003Cspan class=\"shj-num\">header-h\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan> + \u003Cspan class=\"shj-num\">16\u003C\u002Fspan>\u003Cspan class=\"shj-var\">px\u003C\u002Fspan>\u003Cspan class=\"shj-num\">\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>;\n\u003Cspan class=\"shj-bracket\">}\u003C\u002Fspan>\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>","\u003Cdiv class=\"shj shj-lang-js shj-multiline\" data-lang=\"js\">\u003Cdiv class=\"shj-scroll\">\u003Cdiv class=\"shj-numbers\">\u003Cdiv>1\u003C\u002Fdiv>\u003Cdiv>2\u003C\u002Fdiv>\u003Cdiv>3\u003C\u002Fdiv>\u003Cdiv>4\u003C\u002Fdiv>\u003Cdiv>5\u003C\u002Fdiv>\u003Cdiv>6\u003C\u002Fdiv>\u003C\u002Fdiv>\u003Cdiv class=\"shj-code\">\u003Cspan class=\"shj-kwd\">const\u003C\u002Fspan> header \u003Cspan class=\"shj-oper\">=\u003C\u002Fspan> document\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>\u003Cspan class=\"shj-func\">querySelector\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>\u003Cspan class=\"shj-str\">\"header\"\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>;\n\u003Cspan class=\"shj-kwd\">const\u003C\u002Fspan> \u003Cspan class=\"shj-func\">setHeaderHeight\u003C\u002Fspan> \u003Cspan class=\"shj-oper\">=\u003C\u002Fspan> \u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan> \u003Cspan class=\"shj-kwd\">=&gt;\u003C\u002Fspan>\n  document\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>documentElement\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>style\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>\u003Cspan class=\"shj-func\">setProperty\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>\u003Cspan class=\"shj-str\">\"--header-h\"\u003C\u002Fspan>\u003Cspan class=\"shj-oper\">,\u003C\u002Fspan> \u003Cspan class=\"shj-str\">`\u003C\u002Fspan>\u003Cspan class=\"shj-kwd\">${\u003C\u002Fspan>header\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>offsetHeight\u003Cspan class=\"shj-kwd\">}\u003C\u002Fspan>\u003Cspan class=\"shj-str\">px`\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>;\n\n\u003Cspan class=\"shj-func\">setHeaderHeight\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>;\n\u003Cspan class=\"shj-kwd\">new\u003C\u002Fspan> \u003Cspan class=\"shj-class\">ResizeObserver\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>setHeaderHeight\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>\u003Cspan class=\"shj-oper\">.\u003C\u002Fspan>\u003Cspan class=\"shj-func\">observe\u003C\u002Fspan>\u003Cspan class=\"shj-bracket\">(\u003C\u002Fspan>header\u003Cspan class=\"shj-bracket\">)\u003C\u002Fspan>;\u003C\u002Fdiv>\u003C\u002Fdiv>\u003C\u002Fdiv>",{"locked":18,"total":19,"comments":411},[]]