<ol>
<li>test</li>
<li>test</li>
</ol>
will show as:
- test
- test
I want to have numbers coloured and text black!
I can edit the css, but I do not have access to the HTML.
<ol>
<li>test</li>
<li>test</li>
</ol>
will show as:
I want to have numbers coloured and text black!
I can edit the css, but I do not have access to the HTML.
Here's a solution that also wraps the text for each list item left-aligned below the first line (and not below the list number):
HTML
CSS
To expand a bit on what others said, as well as additional question clarifications, there is no built-in way of doing this from CSS w/o touching the HTML. If you are looking to keep the HTML as clean and semantic as possible, I would do the styling using javascript, probably with a library like jQuery, to adjust the DOM so that the css can be more effective.
I would caution, however, using color to convey info. I'm not sure what the purpose of the colored numbers is, but using color to display information leaves colorblind users out of the loop and is a big no no for accessibility.
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:
css:
Not sure if this works but i think it should:
edit
If you cannot edit the html then I'm afraid it's not possible. If you could add javascript to the HTML (once in the head) then you could do it like this:
You will need the jQuery library for this.
Then in your CSS just set up a red and a black class with color:red/black declarations.
From an answer to a similar question I found elsewhere:
But for now it looks like you'd have to add the
<span>
to your html.