我认为这个问题的答案是否定的...但是有人知道一种 HTML/CSS 方法来创建一个数字后面没有句点的有序列表吗?或者,指定分隔符?
理想情况下,我不想为每个数字使用不同的类进行列表样式图像,但这就是我到目前为止所能想到的......这看起来非常不语义。
IE:
Default Style:
1. ______
2. ______
3. ______
Desired Style:
1 ______
2 ______
3 ______
Alternate Style:
1) ______
2) ______
3) ______
仅使用 CSS (2.1) 就完全可以做到这一点:
ol.custom {
list-style-type: none;
margin-left: 0;
}
ol.custom > li {
counter-increment: customlistcounter;
}
ol.custom > li:before {
content: counter(customlistcounter) " ";
font-weight: bold;
float: left;
width: 3em;
}
ol.custom:first-child {
counter-reset: customlistcounter;
}
请记住,此解决方案依赖于 :before 伪选择器,因此某些较旧的浏览器(尤其是 IE6 和 IE7)不会呈现生成的数字。对于这些浏览器,您需要添加一个额外的 CSS 规则,仅针对它们使用普通的列表样式:
ol.custom {
*list-style-type: decimal; /* targets IE6 and IE7 only */
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)