I want to change an area to max overflow:scroll only if ::-webkit-scrollbar-thumb is supported.
Is that possible somehow in pure CSS? As it seems @supportsonly checks rules, no selectors.
I want to change an area to max overflow:scroll only if ::-webkit-scrollbar-thumb is supported.
Is that possible somehow in pure CSS? As it seems @supportsonly checks rules, no selectors.
You can now use @supports selector() to target pseudoelements. Here is a relevant example for your use case:
@supports selector(::-webkit-scrollbar-thumb) {
.scroll-container {
overflow: scroll
}
}
Please see this JSFiddle, which demonstrates browser support for ::-webkit-scrollbar-thumb in
but not
As of February 2024, browser support for @supports selector is roughly 94%.
@supports selector(::-webkit-scrollbar-thumb){/*Chrome yay, Firefox nay*/} does work if it must.You are correct. @supports only deals with property-value combinations. The only way you could do this in pure CSS is with a CSS hack targeting browsers that support ::-webkit-scrollbar-thumb. (Not enough browsers support @supports for it to be useful in checking support for ::-webkit-scrollbar-thumb anyway.)