473,569 Members | 2,768 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Applying background color to ordered list numbers, NOT content

404 Contributor
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 3809
404 Contributor
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

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

Similar topics

by: Ken Innes | last post by:
Apparently, surrounding an ordered list by a font command is illegal. So how do I specify the font style and size for the list elements? Putting font tags on each list item works, except that the list numbers don't display in that font. Invalid, but it works on all (most?) browsers: <font face="Arial" size=2> <ol> <li>List Item A<br>
by: Stephen Miller | last post by:
Hi, How can I configure an ordered list so that the bullet is placed on the right hand side of the list item. ie: list item 1 * list item 2 * list item 3 * Thanks,
by: Jim Cobban | last post by:
I cannot get Netscape 4.79 to properly display the ordered list in the following fragment. <P>Get a specific portion of the date. Depending upon the value of index: <ol start=0> <li>complete value, usually as a <code>String</code>, or if an integral value as an <code>Integer</code>. <li>year as an <code>Integer</code> <li>month number as...
by: Bosconian | last post by:
I have two multiple select inputs. Initially the first contains a bunch of items and the second is empty. Using a common method, I move items back and forth by double clicking on them. This portion works perfectly, but I would also like to change the background color of the select element with the current focus. I have defined the...
by: deko | last post by:
http://www.liarsscourge.com/ewpi.html The list numbers should be formatted as <h3>, but other text within the <li> should be normal text. <ol> <li> <h3 id="d2">Download latest WordPress code</h3> </li>
by: shapper | last post by:
Hello, I have the following: <ol id ="ol"> <li id="li1">item1</li> <li id="li2">item2</li> <ol> Is it possible to display the List Items on the horizontal, i.e., side
by: zimmerman222 | last post by:
I'm developing a page in order to present map with a legend. The temporary URL is http://www24.brinkster.com/plaidthermos/legend.html I would like to have the legend's <li> numbers have the same background circle as the items it refers to on the map. I have managed to get a background image for each li, but it can't seem to display the...
by: Yoav Rubin | last post by:
Hi All, I am using an ordered list in which each item is a div that its size is two times as much as the size of the numbers of the ordered list. As it is now, the numbers are aligned to the bottom of the list items, and I'd like to align the numbers to be in the middle of the list items. Does anyone has any idea how to do it? thanks Yoav
by: =?Utf-8?B?U2V0aA==?= | last post by:
I have a simple test application with a list view using custom draw to change the text background color. The list view uses a background image which I set using LVBKIMAGE img = {LVBKIF_SOURCE_URL, NULL, "file://C:\\source\\mcp\\ebs.jpg"}; ListView_SetBkImage(hList, &img); I have a linker pragma comment that I use to engage comctl32.dll...
by: some old html fumbler | last post by:
I want to use CSS to get an ordered list to start with something other than a 1 or equivalent. I have a list of things that happen during the course of a year. Too long a list is not helpful, so I only show maybe 3 months of items at a time. The items have to be ordered according to the year, IOW I can't list something in April as being #1....
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.