Search
No Motion Isn’t Always prefers-reduced-motion
8.2.2022
There is a code snippet that I see all the time when the media query prefers-reduced-motion is talked about. Here it is:
@media (prefers-reduced-motion: reduce) {
* {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms...
“Cancelable” Smooth Scrolling
2.2.2021
Here’s the situation: Your site offers a “scroll back to top” button, and you’ve implemented smooth scrolling. As the page scrolls back to the top, users see something that catches their eye and they want to stop the scrolling, so …
The post “Cancelable”...
Fixing Smooth Scrolling with Find-on-Page
13.1.2021
Back when we released the v17 design (we’re on v18 now) of this site. I added html { scroll-behavior: smooth; } to the CSS. Right away, I got comments like this (just one example):
… when you control+f or
…
The post Fixing Smooth Scrolling with Find-on-Page appeared first...
How to Make an Unobtrusive Scroll-to-Top Button
5.10.2020
A button to return to the top of the page allows the user to quickly return to the top of the page without making too much effort. This can be very useful when the page has a lot of content or which happens, for example, on one page websites, when infinite scrolling is used, or on mobile devices...
CSS-Only Carousel
10.1.2020
It's kind of amazing how far HTML and CSS will take you when building a carousel/slideshow.
Setting some boxes in a horizontal row with flexbox is easy.
Showing only one box at a time with overflow and making it swipable with -webkit-overflow-scrolling is easy.
You can make the "slides" line...
Need to scroll to the top of the page?
2.9.2019
Perhaps the easiest way to offer that to the user is a link that targets an ID on the <html> element. So like...
<html id="top">
<body>
<!-- the entire document -->
<a href="#top">Jump to top of page</a>
...
Downsides of Smooth Scrolling
11.3.2019
Smooth scrolling has gotten a lot easier. If you want it all the time on your page, and you are happy letting the browser deal with the duration for you, it's a single line of CSS:
html {
scroll-behavior: smooth;
}
I tried this on version 17 of this site, and it was the second most-hated thing...
Scroll to the Future
19.4.2018
This is an interesting read on the current state of scrollbars and how to control their behavior across operating systems and browsers. The post also highlights a bunch of stuff I didn’t know about, like Element.scrollIntoView() and the scroll-behavior CSS property.
My favorite part of all though?...