How to add order list numbers without

How to add order list numbers without "ol" and "ul" elements by CSS for all browsers?


Suppose you want to number things on your website without "ol" and "ul" elements. It is reasonable that you want to style those numbers. In this article, we will show how it can do with the: before pseudo-element, which can have a counter as a value to the content property.

But let it be known, applying numbered counters is not limited to ordered lists. For instance, you wanted to number the question-and-answer pairs of a FAQ list.


     <dt>What is Lorem Ipsum?</dt>
     <dd>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500.</dd>

     <dt>Where does it come from?</dt>
     <dd>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old.</dd>

     <dt>Why do we use it?</dt>
     <dd>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English.</dd>

     <dt>Where can I get some?</dt>
      <dd>There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable.</dd>

To add ordered list numbers without using the "ol" and "ul" elements in CSS for all browsers, you can follow these steps:


<style type="text/css">

     dl {
           counter-reset: number;
     dl dt {
           position: relative;
     dl dt:before {
           content: counter(number);
           counter-increment: number;
           position: absolute;
           left: 0;
           top: 0;

     dl dd {
           margin: 0 0 20px;
     dl dt, dl dd {
           padding-left: 20px;

These are default list styles in all browsers.

  • disc (• • •)
  • circle (○ ○ ○)
  • square (▪ ▪ ▪)
  • decimal (1 2 3)
  • decimal-leading-zero (01, 02, 03)
  • lower-roman (i ii iii)
  • upper-roman (I II III)
  • lower-greek (α β γ)
  • lower-latin (a b c)
  • upper-latin (A B C)
  • armenian (Ա Բ Գ)
  • georgian (ა ბ გ)
  • lower-alpha (a b c)
  • upper-alpha (A B C)

If you want to show "lower-roman""upper-roman", and "decimal", etc., specify which in the counter value itself:


<style type="text/css">
     dl dt:before {
      content: counter(number, lower-roman);

Contact us:+91 8128405131

Email send us at hello@elightwalk.com

Ravi Baghel
Frontend Developer

A professional frontend developer with 5 years of experience who excels in tackling complex challenges. Their expertise focuses on creating SEO- and mobile-friendly products that fit customer needs. He works closely with fellow front-end engineers, helping to adopt best practices and stay abreast of new technologies.

Most Visited Blog

How to get the show anchor tag title on mouseover in css3.

Elevate user experience with CSS3! Learn how to showcase anchor tag titles on markup, adding a dynamic touch to your website. Explore our quick guide for seamless implementation.

Read More
How to get the border radius working in IE8?

Navigate the difficulties of IE8 compatibility! Our tutorial outlines easy measures to ensure border-radius functioning, ensuring website retains a professional image across several browsers, including Internet Explorer 8.

Read More
SVG - Scalable Vector Graphics

Unleash the power of SVG! Explore the versatility and benefits of this scalable and responsive picture format with this quick explanation of Scalable Vector Graphics.

Read More