gpt4 book ai didi

html - 如何在 CSS 中设置伪计数器的样式

转载 作者:行者123 更新时间:2023-11-28 17:45:23 26 4
gpt4 key购买 nike

如何更改此示例中计数器的字体大小:

<style>
p
{
counter-increment: myIndex;
}

p:before
{
content:counter(myIndex);
}
</style>

网页内容

<p>First make a variable (myIndex) and make it increase every time a p element occurs.</p>
<p>Then insert the counter in front of all p elements</p>
<p><b>Note:</b> For the counter property to work in IE8, a DOCTYPE must be declared.</p>

http://www.w3schools.com/cssref/tryit.asp?filename=trycss_content_counter

最佳答案

只需为 :before 伪设置 font-size

Demo Fiddle

p {
counter-increment: myIndex;
}
p:before {
content:counter(myIndex);
font-size:30px;
}

关于html - 如何在 CSS 中设置伪计数器的样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23325738/

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