Discussion
Loading...

Post

  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
CSS Basics
@cssbasics@hachyderm.io  ·  activity timestamp last week

Prevent scrollbar jump: "The scrollbar-gutter #CSS property tells the browser to reserve space for a scrollbar, even when one isn’t visible. It can be used to prevent that visual shift." https://gomakethings.com/prevent-scrollbar-jump/

Prevent scrollbar jump

With modal components, it’s common/expected to prevent the background from scrolling. /** * Prevent background scrolling with a modal dialog is open */ html:has(dialog[open]:modal) { overflow: hidden; } However, if your page was long enough that there were visible scrollbars, they disappear when you set overflow to hidden, which causes the layout to shift horizontally. Sometimes it’s hard to see behind the modal backdrop, but it’s often visible and a bit jarring.
  • Copy link
  • Flag this post
  • Block
Log in

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.0-rc.3.13 no JS en
Automatic federation enabled
  • Explore
  • About
  • Members
  • Code of Conduct
Home
Login