From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/css/@counter-style/pad/index.html | 86 +++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 files/zh-cn/web/css/@counter-style/pad/index.html (limited to 'files/zh-cn/web/css/@counter-style/pad') diff --git a/files/zh-cn/web/css/@counter-style/pad/index.html b/files/zh-cn/web/css/@counter-style/pad/index.html new file mode 100644 index 0000000000..9dcfb0328a --- /dev/null +++ b/files/zh-cn/web/css/@counter-style/pad/index.html @@ -0,0 +1,86 @@ +--- +title: pad +slug: Web/CSS/@counter-style/pad +translation_of: Web/CSS/@counter-style/pad +--- +
{{CSSRef}}
+ +

pad属性和自定义记数样式一起使用时, 可以用来限定记数样式的最小长度. 如果某个记数样式小于pad所指定的长度, 那么会用pad指定的填充字符串来填充至指定长度. 如果比pad所指定的长度长, 则会正常显示. Pad 属性的第一个参数是最小长度, 第二个参数是填充字符串. 一个常见的用处是序号编号需要填充两位的时候, 即需要编号"01","02","03",……, 而不仅仅是1, 2, 3...

+ +

{{cssinfo}}

+ +

参数

+ +
pad: 3 "0";
+
+ +

参数值

+ +
+
<integer> && <symbol>
+
<integer> 表示所有计数样式必须达到的最小长度(必须是非负整数). 如果指定的最小长度没有达到, 将会用<symbol>来填充直到最小长度.
+
+ +

形式语法

+ +
{{csssyntax}}
+ +

样例

+ +

HTML

+ +
<ul class="list">
+  <li>One</li>
+  <li>Two</li>
+  <li>Three</li>
+  <li>Four</li>
+  <li>Five</li>
+</ul>
+ +

CSS

+ +
@counter-style pad-example {
+  system: numeric;
+  symbols: "0" "1" "2" "3" "4" "5";
+  pad: 2 "0";
+}
+
+.list {
+  list-style: pad-example;
+}
+ +

结果

+ +

{{ EmbedLiveSample('Example', '', '', '', 'Web/CSS/@counter-style/pad') }}

+ +

Specifications

+ + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('CSS3 Counter Styles', '#descdef-counter-style-pad', 'pad')}}{{Spec2('CSS3 Counter Styles')}}Initial definition
+ +

浏览器兼容性

+ + + +

{{Compat("css.at-rules.counter-style.pad")}}

+ +

参见

+ + -- cgit v1.2.3-54-g00ecf