Urgent.News

What's breaking now, across thousands of outlets.

Tech

Keep CSS scroll snap targets visible below a fixed header

A scroll-snap layout can select the correct section and still feel broken: the section heading lands beneath a fixed header. The snap rule is not necessarily wrong. The scrolling container simply has no knowledge that part of the visible area is occupied by persistent chrome. The implementation decision is to reserve that shared space on the scroll container with scroll-padding-top , using the…

Scroll snap layouts often appear to fail when the section heading appears beneath a fixed header. The issue arises because the scrolling container does not recognize that the persistent chrome, such as a fixed header, occupies part of the visible area. To resolve this, developers can reserve space on the scrolling container using scroll-padding-top, setting it to the height of the fixed header.

This alters the container's effective snapport, making the area below the header the usable top edge for snap alignment. By maintaining the section's existing scroll-snap-align: start and the container's mandatory vertical snapping, the layout remains consistent. The key difference lies in how child alignment and scroll padding are defined.

Adding padding to each section may seem like a solution, but it changes the content geometry and reiterates viewport-level concerns in each target. Instead, the scroller (fixed header) owns the offset, ensuring that later snapped headings appear below the fixed header without compromising strictness or altering heading content within each section.

Verification should focus on the geometric relationship between the heading and header, checking that the heading's top edge is at or below the header's bottom edge after snapping. This approach also confirms that the original snap type and child alignment are preserved. A notable exception occurs with the first target, which starts at scroll position zero.

In this case, a top padding offset cannot create negative scroll space above it, potentially placing it beneath the fixed header. For scenarios requiring distinct individual offsets rather than a shared overlay allowance, child-level scroll-margin is more appropriate. Additionally, if the interaction demands pixel-perfect positioning rather than navigation through snap targets, it may be more suitable to reconsider the use of scroll snap.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Shopify's image_tag already lazy-loads. Here's what it leaves to you.

I used to write my own lazy-loading logic in every Shopify theme. Then I read the image_tag docs properly and deleted most of it.

  • Shopify's imagetag implements lazy-loading but lacks full performance optimization
  • Imagetag adds width, height, srcset, lazy-loading for non-critical images, and uses WebP/AVIF

Part 29: Agent cards in practice

Part 29 · One Agent, Five Platforms An agent card is a CV for an agent. It tells other agents who it is, what it can do, where to reach it and how to prove who's calling.

  • Agent card contains agent's name, description, version and capabilities.
  • Invoice exception agent is read-only, uses Entra agent identity for authentication.
  • Supplier-communication agent drafts reply skill, but doesn't send emails.

How to Answer 'Tell Me About Yourself' in a Scrum Master Interview

How to Answer “Tell Me About Yourself” in a Scrum Master Interview The best way to answer “Tell me about yourself” in a Scrum Master interview is to stop listing your certifications and start telling…

  • Focus on optimizing flow and eliminating systemic blockers rather than managing Jira tickets
  • Bridge technical and business perspectives to convert roadmaps into clear, value-driven sprints
  • Cultivate psychological safety through constructive Sprint Retrospectives and inclusive daily syncs

More from Wednesday 18 November →