< ol>与数字另一种颜色 [英] <ol> with numbers another color

查看:147
本文介绍了< ol>与数字另一种颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<ol>
   <li>test</li>
   <li>test</li>
</ol>

将显示为:


  1. 测试

  2. 测试

我可以编辑css,但我无法访问HTML。

I can edit the css, but I do not have access to the HTML.

推荐答案

CSS规格提供了一个示例做这个。不幸的是,虽然它适用于Firefox 3,它似乎不工作在IE7:

The CSS spec gives an example of doing just this. Unfortunately, while it works on Firefox 3, it doesn't appear to work on IE7:

<html>
<head>
    <style>
        ol { counter-reset: item; }
        ol li { display: block; }
        ol li:before {
            content: counter(item) ". ";
            counter-increment: item;
            color: red;
        }
    </style>
</head>
<body>
    <ol>
        <li>item</li>
        <li>item</li>
        <li>item</li>
    </ol>
</body>
</html>

这篇关于&lt; ol&gt;与数字另一种颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆