Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8150215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T15:00:34+00:00 2026-06-06T15:00:34+00:00

I have an ordered list which I have styled in two ways: Coloured the

  • 0

I have an ordered list which I have styled in two ways:

  1. Coloured the numbers differently to the list text
  2. Applied a background colour and border to each list item

See the list on the right hand side of this page

The numbers are made orange by first applying the orange style to the <li>, then applying the black style to the list text only using jQuery:

jQuery('#secondary ol li').wrapInner('<span class="notes"> </span>');

I would prefer to use CSS only, but hey.

So the remaining issue is how to extend the background colour/border under the numbers too.

Thanks for checking out my question!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T15:00:35+00:00Added an answer on June 6, 2026 at 3:00 pm

    Revised Answer: jsFiddle Pure CSS Solution

    Here is a revised method that does not use the OP’s original jQuery framework, a request that was not fulfilled in my previous answer. That method used existing jQuery to apply a span wrapper for the li element since direct HTML modification was not possible.

    This new method uses CSS Pseudo selectors :before and :after along with CSS 2.1 counter function that can have it’s number list stylized so that no jQuery wrapper is needed. In fact, the jsFiddle revision shows the numbers using Google @font-face font.

    enter image description here

    Using the CSS counter function is done by declaring a variable name to use in the ul element, then incrementing the counter in the :before element as well as using it as actual content.

    Simple Example: jsFiddle CSS Counter

    enter image description here

    HTML:

    <ul>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>    
        <li>A numbered list that's stylized!</li>    
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>
        <li>A numbered list that's stylized!</li>    
    </ul>
    

    CSS:

    ul{
        list-style-type: none;
        white-space: nowrap;
        margin: 0;
        padding: 0;
        width: 210px;
        height: 200px;
        overflow: auto;
        border: 3px solid royalblue;
        /* Setup the counter. */
        counter-reset: yourVariableName;
    }
    li:before{
        /* Advance the number. */
        counter-increment: yourVariableName;
        /* Use the counter number as content. */
        content: 'Item ' counter(yourVariableName) ': ';
        color: royalBlue;
        font-family: 'Impact';
    }
    

    More about CSS counters HERE.

    My original dated answer that uses existing framework in OP’s question is shown below.


    I looked at your Question carefully and then looked at your webpage.

    Here is the solution you need:
    jsFiddle

    To summarize, this are the replacement CSS Rules that make it work:

    #secondary ol {
        color:#F60;
        margin-bottom:0;
        margin-left: 0px;   /* Since 'ul,ol{}' setting in line 108 affects this selector, 'margin-left' is redefined. */
        list-style-position: inside;  /* This will place the number on top and inside of the current color of li */
    }
    
    .notes{
        color:#333;
        width: 230px;
        heigh: 50px;
        display: inline-block;
        vertical-align:text-top;
    }
    

    Result:
    enter image description here


    Extra: This variant example emphasizes the numbers: jsFiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ordered list which has a <input type=text... and <button> field. When
I have a un-ordered list of links, each of which contains some text and
I have two classes: container which contains dynamic ordered list of Element . What
I have a List of objects which are ordered. I would like to remove
I currently have the following html which does not show the ordered list properly
I have a Linq query which returns an ordered list. It works, but when
I have an ordered list which uses large Georgia for the numbering and smaller
I would like to have an ordered list that has the text on the
I have an Ordered List which contains about 100 List Items. This ol makes
I have a generic list which I form from two other lists. The orderby

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.