HTML Element Style How to - Set counter as Hexadecimal Ordered Lists








Question

We would like to know how to set counter as Hexadecimal Ordered Lists.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
ol#shutupjsfiddle {<!--  ww w  . java 2  s .co m-->
  counter-reset: item;
}

bdoy ol#shutupjsfiddle li {
  display: block;
}

ol#shutupjsfiddle li:before {
  counter-increment: item;
  content: "0x0" counters(item, ".") " ";
}
</style>
</head>
<body>
  <ol id="shutupjsfiddle">
    <li>item</li>
    <li>item</li>
    <li>item</li>
    <li>item</li>
  </ol>
</body>
</html>

The code above is rendered as follows: