案例:CSS3 案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
<html>
3
<head>
4
<style type="text/css">
5
body {counter-reset:section;}
6
h1 {counter-reset:subsection;}
7
h1:before
8
{
9
counter-increment:section;
10
content:"Section " counter(section) ". ";
11
}
12
h2:before 
13
{
14
counter-increment:subsection;
15
content:counter(section) "." counter(subsection) " ";
16
}
17
</style>
18
</head>
19
20
<body>
21
22
<p><b>注释:</b>如果已规定 !DOCTYPE,那么 Internet Explorer 8 (以及更高版本)支持 counter-increment 属性。</p>
23
24
<h1>HTML tutorials</h1>
25
<h2>HTML Tutorial</h2>
26
<h2>XHTML Tutorial</h2>
27
<h2>CSS Tutorial</h2>
28
29
<h1>Scripting tutorials</h1>
30
<h2>JavaScript</h2>
31
<h2>VBScript</h2>
32
33
<h1>XML tutorials</h1>
34
<h2>XML</h2>
35
<h2>XSL</h2>
36
37
</body>
38
</html>
39