DEV Community

Micah Gilbert
Micah Gilbert

Posted on

4 1

Some of the (slightly) lesser known CSS features

The features listed here are from The State of CSS 2019.

Scroll Snap

Scroll snap is just what the name says. It makes the user scrolling "snap" to certain points on the page.

More info here.

overscroll-behavior

Normally, when an element with a scrollbar is scrolled all the way down or up, then a parent element will begin to scroll as well. overscroll-behavior can prevent this by not allowing the parent element to scroll.

(The demo here is somewhat finnicky. You have to be scrolling on an area without text, and stop scrolling when you hit the bottom, then start again.)

More info here

will-change

will-change is a strange one. It is a way to tell browsers that a property of an element will change. The Mozilla documentation states that it should only be used when performance problems are seen, and not in anticipation of a performance issue.

This is probably a useless demo, but it shows that sometimes rapid changes could require a will-change tag.

@supports

@supports is a query that checks if a browser supports a certain feature.

@supports (display: grid) {
  /* code here that gives the grid display instructions */
}

@supports not (overscroll-behavior) {
  /* If it doesn't support overscroll-behavior */
}

More info here

Writing modes

This is simply used to change the direction of the text in an element. It's an alternative to rotation of a <p> tag.

More info here

Wrapping up

I hope you learned a new thing or two with some of the newer CSS features that are out there. If there were any I missed or that you want to add, put them in the comments!

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay