Jump to content

Recommended Posts

Hey, will anybody solve this problem or explain me why it is happening to this counter lists that I am creating  in css.

the problem here is that the last group of lists are the continuation of the first group of lists and in between, I have used nested lists, so counter should be continuing the counting after the the first group( 1-5th lists ) of lists( which is from the number 6 - last group of lists) but it doesn't....please tell me why ?


    <style>
        ol{
            counter-reset: section;
            list-style-type: none;
        }
        li::before{
counter-increment: section;
content:Counters(section,":") " ";
        }

    </style>

</head>

<body>
<br><br><br><br>   

<ol>
   <li>text</li>
   <li>text</li>
   <li>text</li>
   <li>text</li>
   <li>text</li>
<ol>
     <li>text</li>
     <li>text</li>
     <li>text</li>
     <li>text</li>
    <li>text
        <ol>
            <li>text</li>
            <li>text</li>
            <li>text</li>
        </ol>
    </li>
    <li>text</li>
    <li>text</li>
    <li>text</li>
    <li>text</li>
    <li>text</li>
</ol>
<li>text</li>
<li>text</li>
<li>text</li>
<li>text</li>
<li>text</li>
<li>text</li>
<li>text</li>
</ol>

 

Share this post


Link to post
Share on other sites

The issue is that you should not have an <ol> tag as a direct child of another <ol> tag. It runs into an <ol> and stops counting there. Your structure should look like this:

<ol>
  <li>text</li>
  <li>text</li>
  <li>text <!-- ol element wrapped in this li -->
    <ol>
      <li>text</li>
      <li>text
        <ol>
          <li>text</li>
          <li>text</li>
          <li>text</li>
        </ol>
      </li>
      <li>text</li>
      <li>text</li>
    </ol>
  </li>
  <li>text</li>
  <li>text</li>
</ol>

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...