suffix
@counter-style 规则的 suffix 描述符指定将添加到标记表示末尾的内容。
语法
css
/* <symbol> value: string, image, or identifier */
suffix: "";
suffix: ") ";
suffix: url("bullet.png");
值
suffix 描述符接受单个 <symbol> 作为其值。
<symbol>-
指定一个附加到标记表示的
<symbol>。它可以是<string>、<image>或<custom-ident>。
正式定义
| 相关的 at-rule | @counter-style |
|---|---|
| 初始值 | “.” (句号后跟一个空格) |
| 计算值 | 同指定值 |
正式语法
suffix =
<symbol>
<symbol> =
<string> |
<image> |
<custom-ident>
<image> =
<url> |
<image()> |
<image-set()> |
<cross-fade()> |
<element()> |
<gradient>
<image()> =
image( <image-tags>? [ <image-src>? , <color>? ]! )
<image-set()> =
image-set( <image-set-option># )
<cross-fade()> =
cross-fade( <cf-image># )
<element()> =
element( <id-selector> )
<image-tags> =
ltr |
rtl
<image-src> =
<url> |
<string>
<image-set-option> =
[ <image> | <string> ] [ <resolution> || type( <string> ) ]?
<cf-image> =
[ <image> | <color> ] &&
<percentage [0,100]>?
<id-selector> =
<hash-token>
示例
为计数器设置后缀
HTML
html
<ul class="choices">
<li>One</li>
<li>Two</li>
<li>Three</li>
<li>None of the above</li>
</ul>
CSS
css
@counter-style options {
system: fixed;
symbols: A B C D;
suffix: ") ";
}
.choices {
list-style: options;
}
结果
规范
| 规范 |
|---|
| CSS Counter Styles Level 3 # counter-style-suffix |
浏览器兼容性
加载中…
另见
- 其他
@counter-style描述符:system、symbols、additive-symbols、negative、prefix、range、pad、speak-as和fallback list-style、list-style-image、list-style-positionsymbols():用于创建匿名计数器样式的功能表示法- CSS 计数器样式模块
- CSS 列表和计数器模块