473,703 Members | 2,886 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 3827
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 an <code>Integer</code>
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 following classes: ..selected {
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 image as a background beyond the left margin of the actual list item, the space occupied by the actual...
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 version 6 to get the XP visual styles:
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. In HTML after the first couple of months I just use this sort of code: <ol start="14"...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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 most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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 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.