471,887 Members | 828 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,887 software developers and data experts.

Applying background color to ordered list numbers, NOT content

404 256MB
I need to know how / if it's possible to apply a background color to a ordered list item's numbers, and not the content itself. I've tried:

Expand|Select|Wrap|Line Numbers
  1. ol {
  2.    background-color: #FFFF00;
  3.    }
But that does the opposite, applies the background color to the list's contents, but not the numbers. I'm making a syntax highlighting script that shows line numbers and I need to be able to clearly separate the line numbers from the code.

Can someone help me achieve this please?
Jun 8 '10 #1
1 3544
404 256MB
That's much more elegant than my solution, but it doesn't work in IE7. My logs show I'm still getting a decent number of visits from IE7 users. Here's the page with my solution:


It even works on my Android phone.
Jun 9 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Ken Innes | last post: by
6 posts views Thread by Stephen Miller | last post: by
33 posts views Thread by Jim Cobban | last post: by
2 posts views Thread by Bosconian | last post: by
20 posts views Thread by shapper | last post: by
16 posts views Thread by some old html fumbler | last post: by
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.