【发布时间】:2021-11-22 09:18:22
【问题描述】:
有没有办法为滚动条轨道添加不透明度?
当我添加关键字opacity:0.5 时,它似乎什么也没做......
我使用了material ui styled,但我认为这与它无关。
const Root = styled('div')(({ theme }) => ({
display: 'flex',
overflow: 'auto',
maxHeight: '750px',
'&::-webkit-scrollbar, & *::-webkit-scrollbar': {
width: '12px',
},
'&::-webkit-scrollbar-track': {
boxShadow: 'inset 0 0 6px rgba(0, 0, 0, 0.3)',
borderRadius: '10px',
opacity: '0.5', // --> this is not apply.
backgroundColor: theme.palette.primary.main,
},
'&::-webkit-scrollbar-thumb': {
boxShadow: 'inset 0 0 6px rgba(0, 0, 0, 0.3)',
borderRadius: '10px',
backgroundColor: theme.palette.primary.main,
},
}));
因为我使用样式化组件,内置主题我希望主题在我将其更改为暗模式时保持一致。
所以我的问题是,是否有办法在不使用关键字 opacity 的情况下将 opcaity 添加到 theme.palette.primary.main。
【问题讨论】:
-
link查看此链接
-
这不像我的情况,他需要完全隐藏滚动条轨道,我正在尝试添加0.5的不透明度
标签: css material-ui