<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/get-the-width-of-the-scrollbar-using-only-css-kewwlthha" -->

---
title: Get the width of the scrollbar using only CSS | daily.dev
description: Learn how to determine the width of the scrollbar using modern CSS without JavaScript. This technique uses a CSS property and defines the value at the :root...
canonical: https://daily.dev/posts/get-the-width-of-the-scrollbar-using-only-css-kewwlthha
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Get the width of the scrollbar using only CSS | daily.dev
og:description: Learn how to determine the width of the scrollbar using modern CSS without JavaScript. This technique uses a CSS property and defines the value at the :root...
og:url: https://daily.dev/posts/get-the-width-of-the-scrollbar-using-only-css-kewwlthha
og:image: https://api.daily.dev/og/posts/kewWlTHHA.png
og:image:alt: Get the width of the scrollbar using only CSS
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Get the width of the scrollbar using only CSS

**[CSS Tip](https://daily.dev/sources/csstip)** · 1 min read · 32 upvotes · 3 comments

## Summary

Learn how to determine the width of the scrollbar using modern CSS without JavaScript. This technique uses a CSS property and defines the value at the :root level, but it's currently supported only in Chrome.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://css-tip.com/scrollbar-width/>

## Community discussion

Top comments from developers on daily.dev.

**@sajithrenalin** · 0 upvotes

> Good

**@petecapecod** · 0 upvotes

> Cool way to do it with CSS. Definitely going to have to bookmark this for later 👍🏻

**@chandrapantachhetri** · 0 upvotes

> This is the first time I'm seeing '@property' syntax. Looked into a bit and it looks useful for animations. Where can I see which browsers support this syntax? I know you said it's only Chrome for now.

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 1 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments
- [CNCF Unveils Schedule for KubeCon \+ CloudNativeCon Europe 2026](https://daily.dev/posts/cncf-unveils-schedule-for-kubecon-cloudnativecon-europe-2026-ikhcoa5cb) · CNCF · 2 upvotes · 0 comments
- [CNCF Debuts KubeCon \+ CloudNativeCon Japan 2026 Schedule](https://daily.dev/posts/cncf-debuts-kubecon-cloudnativecon-japan-2026-schedule-xp5pyudub) · CNCF · 1 upvotes · 0 comments

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#css](https://daily.dev/tags/css), [#frontend](https://daily.dev/tags/frontend)

[View this post on daily.dev](https://daily.dev/posts/get-the-width-of-the-scrollbar-using-only-css-kewwlthha)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Get the width of the scrollbar using only CSS","url":"https://daily.dev/posts/get-the-width-of-the-scrollbar-using-only-css-kewwlthha","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/get-the-width-of-the-scrollbar-using-only-css-kewwlthha"},"datePublished":"2024-07-31T10:41:46.582Z","dateModified":"2024-07-31T10:41:57.322Z","description":"Learn how to determine the width of the scrollbar using modern CSS without JavaScript. This technique uses a CSS property and defines the value at the :root...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/81c35ed7bfbe81027cd979efeb767e8a?_a=AQAEuiZ","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/81c35ed7bfbe81027cd979efeb767e8a?_a=AQAEuiZ","isAccessibleForFree":true,"articleSection":"CSS Tip","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"CSS Tip","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/5d335233e7894c2ea997aa89e1724200","url":"https://daily.dev/sources/csstip"},"commentCount":3,"discussionUrl":"https://daily.dev/posts/get-the-width-of-the-scrollbar-using-only-css-kewwlthha","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":32},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":3}],"keywords":"webdev,css,frontend","timeRequired":"PT1M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"CSS Tip","item":"https://daily.dev/sources/csstip"},{"@type":"ListItem","position":3,"name":"Get the width of the scrollbar using only CSS"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/get-the-width-of-the-scrollbar-using-only-css-kewwlthha","comment":[{"@type":"Comment","text":"Good","datePublished":"2024-07-31T16:43:18.477Z","url":"https://daily.dev/posts/kewWlTHHA#c-B1S5FZEmy","author":{"@type":"Person","name":"Sajith Renalin","url":"https://daily.dev/sajithrenalin","image":"https://lh3.googleusercontent.com/a/ACg8ocIdONDVvLjN5thA53-tqBFJPCpxcqa3FUdaWx1MJNiMJv0t63CJ=s96-c"}},{"@type":"Comment","text":"Cool way to do it with CSS. Definitely going to have to bookmark this for later 👍🏻","datePublished":"2024-08-19T18:40:29.999Z","url":"https://daily.dev/posts/kewWlTHHA#c-Hx3MNICjt","author":{"@type":"Person","name":"Peter Cruckshank","url":"https://daily.dev/petecapecod","image":"https://media.daily.dev/image/upload/s--ZJhQyKws--/f_auto/v1721235024/avatars/avatar_A9xh33q0QoxtkGoJRCosp"}},{"@type":"Comment","text":"This is the first time I’m seeing ‘@property’ syntax. Looked into a bit and it looks useful for animations. Where can I see which browsers support this syntax? I know you said it’s only Chrome for now.","datePublished":"2024-10-22T18:19:08.508Z","url":"https://daily.dev/posts/kewWlTHHA#c-QQZ0yfUwo","author":{"@type":"Person","name":"Chandra Panta Chhetri","url":"https://daily.dev/chandrapantachhetri","image":"https://media.daily.dev/image/upload/s--jyEItTbl--/f_auto/v1731874940/avatars/avatar_7bMGMXLqZfcWec4Z1CnGC"}}]}
```

