gpt4 book ai didi

html - 在纯CSS中将阿拉伯数字转换为罗马数字

转载 作者:可可西里 更新时间:2023-11-01 12:55:21 26 4
gpt4 key购买 nike

我正在为网站编写自定义主题,所以我不能使用 Javascript。我想将一些数字转换为罗马数字

我试过这个:

.score:before {
counter-reset: mycounter attr(score number, 0);
content: counter(mycounter, upper-roman) " ";
}
 <p><span class="score" score="11">points</span></p>

唉,似乎“attr(score number, 0)”总是0。这不是因为回退,因为当我将回退数更改为42时,结果保持为0。这不是其他地方的问题代码,因为当我用 42 这样的数字替换 attr(...) 时它工作正常。

那么为什么这段代码没有显示它应该显示的内容呢?

最佳答案

即使在今天,attr() 仍然只支持 content: 用法,不支持任何其他用途,正如您从这里的所有危险信号中看到的那样:https://caniuse.com/#feat=css3-attr

屏幕截图:

caniuse-attr

关于html - 在纯CSS中将阿拉伯数字转换为罗马数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54024079/

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