DEV Community

Sibaram Sahu
Sibaram Sahu

Posted on

5 1

New in CSS

Declare Variable

:root {
    --global--primary-color: #29313e;
}


a {
    color: var(--global--primary-color);
}

Enter fullscreen mode Exit fullscreen mode

@Supports

It allows you to do the same depending on what CSS properties and values the user browser supports.

@supports (display: grid) {
    .main-content {
        display: grid;
    }
}
Enter fullscreen mode Exit fullscreen mode

content-visibility

It is a really cool new CSS feature to improve site performance. It basically works like lazy loading, only not for images but any HTML element. You can use it to keep any part of your site from loading until it becomes visible.

.sec-viewport {
    content-visibility: auto;
}
Enter fullscreen mode Exit fullscreen mode

Scroll Snap

Scroll snapping gives you the option to lock the user’s viewport to a certain parts or element of your site.

.container {
    scroll-snap-type: y mandatory;
}
Enter fullscreen mode Exit fullscreen mode

:is and :where

It allow you to reduce repetition in CSS markup by shortening lists of CSS selectors.

/* Before */
.main a:hover,
.sidebar a:hover,
.site-footer a:hover {
    /* markup goes here */
}
Enter fullscreen mode Exit fullscreen mode
/* After */

:is(.main, .sidebar, .site-footer) a:hover {
    /* markup goes here */
}

:where(.main, .sidebar, .site-footer) a:hover {
    /* markup goes here */
}
Enter fullscreen mode Exit fullscreen mode

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

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

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

Okay