in Education by
I'm currently working on a project converting some training materials from one e-learning system to another, and I'm trying to preserve original formatting where I can (especially when lists tie into images), and this has involved picking up some HTML/CSS commands to help recreate formatting (I'm keeping notes for my colleagues on functions that I'm using so they can also understand it). In the current lesson, the list of instructions I'm working with is spreading over multiple "cards." I've mostly been able to make this work, but the current card has a graphic tie-in that I'm having some difficulty puzzling out. What I'm trying to do on this card: 4. Instruction item 4 5. Instruction item 5 5.1 Sub-instruction 1 5.2 Sub-instruction 2 5.3 Sub-instruction 3 Graphic referenced by above 6. Instruction item 6 etc. The current code sections that I'm finding are not quite getting to that result, though. I've been researching online (including here), and I'm finding information that helps me get to the X.Y formatting and information that gets me the changing start point, but not ways to use both in context of a multi-level list. I can almost make this work using the below code snippet: OL { counter-reset: item 3 } LI { display: block } LI:before { content: counters(item, ".") " "; counter-increment: item }
  1. Instruction 4
  2. Instruction 5:
  3. Sub-item 1
  4. Sub-item 2
  5. Sub-item 3
Instead of: 4. Instruction item 4 5. Instruction item 5 5.1 Sub-instruction 1 5.2 Sub-instruction 2 5.3 Sub-instruction 3 the above code section currently gives me: 4 Item 4 5 Item 5 5.4 Sub Item 1 5.5 Sub Item 2 5.6 Sub Item 3 If I substitute "counter-reset: item" for "counter-reset: item 3" I instead get: 1. Instruction item 4 2. Instruction item 5 2.1 Sub-instruction 1 2.2 Sub-instruction 2 2.3 Sub-instruction 3 Push comes to shove I could use separate lines of text and the appropriate line padding to get the desired effect (or try to change the graphics), but ideally I'd like to find a way to get the list to automatically format appropriately so we can use this for future lessons. Any assistance to help with where I'm going wrong would be greatly appreciated. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
First of all, you should have your nested ol in a li. The only allowed children of an ol are li. Now, let's see what you can do with a second counter: ol { counter-reset: item 3} li { display: block } ol > li:before { content: counters(item, "") " "; counter-increment: item } ol ol { counter-reset: tata 0; /* Second counter */ } ol ol li:before { content: counters(item, "") "." counters(tata, "") " "; counter-increment: tata; }
  1. Instruction 1
  2. Instruction 2: Sub-item 1
  3. Sub-item 2
  4. Sub-item 3
Run code snippetExpand snippet

Related questions

0 votes
    I want to right align alternate list elements and keep the other left making it a ZIG-ZAG list Something ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    Is there a better way to see what guests have access to within SharePoint at the content level?...
asked Mar 10, 2021 in Technology by JackTerrance
0 votes
    Blurry Image Original image I have a simple image upload function in php. It takes an image and uploads it to ... below for the upload and the calling. gallery.php uploadFile.php...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 1, 2022 in Education by JackTerrance
0 votes
    I'm currently trying to use lightbox in my project! And as you notice I using a (v-for) for the ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 13, 2022 in Education by JackTerrance
0 votes
    I have a 9-cell grid containing images (using bootstrap columns). The grid works fine and is responsive ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    As the title says, why does my html template look different on three different screen sizes? I understand ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    I am using a table to display data .I am trying to remove space from the left and right of th ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 12, 2022 in Education by JackTerrance
0 votes
    Now that most of the major browsers support full page zoom (at present, the only notable exception being ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 29, 2022 in Education by JackTerrance
0 votes
    I have the following HTML This is going to be big title Foo Bar FooBar BarFoo The text does not ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 9, 2022 in Education by JackTerrance
0 votes
    I have the following HTML This is going to be big title Foo Bar FooBar BarFoo The text does not ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 9, 2022 in Education by JackTerrance
0 votes
    I have something like this First table Second table And the following CSS table { margin-bottom:40px; } ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 3, 2022 in Education by JackTerrance
0 votes
    I have something like this First table Second table And the following CSS table { margin-bottom:40px; } ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I have this grid: If I change the tables width from 100% to auto, table collapses horizontally. Which ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    Is there a way to revert a git commit that’s already been pushed and made public?...
asked Nov 4, 2020 in Technology by JackTerrance
...