this is a question related to a case mentioned here: Handling a colon in an element ID in a CSS selector
这是一个与这里提到的情况相关的问题:在CSS选择器的元素ID中处理冒号
I have some code which contains footnotes which are noted this way 1 and 2 etc.
我有一些包含脚注的代码,这些脚注是这样标注的:1 等。
In my css I know how to make a rule for each case
在我的css中,我知道如何为每种情况制定规则
sub#fnref\:fn1 {vertical-align: super} // or "\3A" instead of ":" to be correct
sub#fnref\:fn2 {vertical-align: super}
But how to write the css to get all cases into one rule (I don't want to make a endless list for all potential footnotes.
但是如何编写css使所有的情况都成为一个规则(我不想为所有可能的脚注列出一个无穷无尽的列表。
Thanks in advance Florian
提前感谢弗洛里安
1 个解决方案
#1
3
Use an attribute selector instead:
使用属性选择器代替:
sup[id^="fnref:fn"] {vertical-align: super}
By the way you should be selecting sup elements and not sub elements.
顺便说一下,你应该选择sup元素而不是子元素。