Clipping Scrollable Areas On The inline-start Side
Publikováno: 19.2.2021
On a default left-to-right web page, “hanging” an element off the right side of the page (e.g. position: absolute; right: -100px;
) triggers a horizontal scrollbar that scrolls as far as needed to make that whole element visible. But if …
The post Clipping Scrollable Areas On The inline-start Side appeared first on CSS-Tricks.
You can support CSS-Tricks by being an MVP Supporter.
On a default left-to-right web page, “hanging” an element off the right side of the page (e.g. position: absolute; right: -100px;
) triggers a horizontal scrollbar that scrolls as far as needed to make that whole element visible. But if you hang an element of the left side of the page, it’s just hidden (no scrollbar is triggered). That’s called “data loss” in CSS terms, if you’re fancy. The same is true for the top edge of the page (hidden) and bottom of the page (scrolling happens).
Ahmad puts a point on this. It’s just one of those CSS things that you just need to know. I love how Ahmad uses logical directions like inline-start
direction (and block-start
direction) to describe the issue because those directions change when the direction or writing mode of the page changes. If the page is right-to-left (RTL) like <html dir="rtl">
, then horizontal edges where the data loss occurs are flipped (except in Firefox 🤷♀️).
Direct Link to Article — Permalink
The post Clipping Scrollable Areas On The inline-start Side appeared first on CSS-Tricks.
You can support CSS-Tricks by being an MVP Supporter.