-1

So, I've tried to change it and I found a way but I don't think that's the correct way, because I changed every single "li".

Is there a professional way?

and thanks

.ul-list {
  display: flex;
  background-color: #eeeeee;
  color: black;
  width: 400px;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.ul-list .ol-html {
  margin: 20px;
  list-style-type: none;
}

.ul-list .ol-html #slim::before {
  content: counter(number) ".";
  counter-increment: number 10;
}

.ul-list .ol-html #pugjs::before {
  content: counter(number) ".";
  counter-increment: number 11;
}

.ul-list .ol-html #haml::before {
  content: counter(number) ".";
  counter-increment: number 12;
}
<ul class="ul-list">
  <li>
    HTML
    <ol class="ol-html">
      <li id="slim">Slim</li>
      <li id="pugjs">Pugjs</li>
      <li id="haml">HAML</li>
    </ol>
  </li>
</ul>
Juan
  • 4,910
  • 3
  • 37
  • 46
  • 1
    If you just want to change start number, see [this(Is it possible to specify a starting number for an ordered list?)](https://stackoverflow.com/questions/779016/is-it-possible-to-specify-a-starting-number-for-an-ordered-list) – Shuo Mar 06 '23 at 03:46
  • yes, and thank you very much, i've found the answer and it's like this – Abdalmalk kasem Mar 06 '23 at 19:24

3 Answers3

2

You can add any styles to your lists, it can be numbers, emojis

li {
  list-style-type: thumbs;
}

@counter-style thumbs {
  system: cyclic;
  symbols:   ;
  suffix: " ";
}
<ul>
  <li><i class="bi bi-check"></i> Buy Milk</li>
  <li><i class="bi bi-check"></i> Buy Egg</li>
  <li><i class="bi bi-check"></i> Buy Bread</li>
</ul>
buzz
  • 896
  • 2
  • 10
  • 22
1

If your goal it's to start the counter for the ol.ol-html at 10 you can use the start attribute on the ol

.ul-list {
  display: flex;
  background-color: #eeeeee;
  color: black;
  width: 400px;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.ul-list .ol-html {
  margin: 20px;
}
<ul class="ul-list">
  <li>
    HTML
    <ol class="ol-html" start="10">
      <li id="slim">Slim</li>
      <li id="pugjs">Pugjs</li>
      <li id="haml">HAML</li>
    </ol>
  </li>
</ul>
Juan
  • 4,910
  • 3
  • 37
  • 46
1

I found the answer.

So if we want to start attributing for an ordered list using only CSS we will use counter-increment property.

Example:

  ol {
      list-style: none;
      counter-increment:start 9;
}

   li::before {
      content: counter(start, decimal) ". ";
      counter-increment: start;
}
<ol>
  <li>A</li>
  <li>B</li>
  <li>C</li>
</ol>

so here counter-increment it's 0-indexed, so to get a list that starts at 10, use 9