gpt4 book ai didi

css - 在 css3 颜色中使用数据属性

转载 作者:技术小花猫 更新时间:2023-10-29 11:43:37 24 4
gpt4 key购买 nike

我正在尝试根据值为进度条着色。

progress[value]::-webkit-progress-value {
position: relative;
background-color: rgba(0, attr(value) ,0,1);
background-size: 35px 20px, 100% 100%, 100% 100%;
border-radius:3px;

/* Let's animate this */
animation: animate-stripes 5s linear infinite;
}

看起来 attr(value) 似乎不起作用 - 有没有办法在其中注入(inject)值(value)?使用 Chrome

最佳答案

如果你之前使用伪元素来显示你的进度?也许这可行?

progress[value]::-webkit-progress-value {

&:before{
content: [attr-data];
display: block;
position: relative;
background-color: rgba(0, attr(value) ,0,1);
background-size: 35px 20px, 100% 100%, 100% 100%;
border-radius:3px;

/* Let's animate this */
animation: animate-stripes 5s linear infinite;
}

}

关于css - 在 css3 颜色中使用数据属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39090626/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com