Quite simply, I want an ordered list to work like this:
1. Foo
2. Bar
3a. Baz
3b. Qux
4. Etc...
Is there any way to easily do something along these lines in HTML?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Given the following mark-up:
The following CSS almost works:
JS Fiddle demo.
The only problem with this, so far, is that it contains the
topLevelcount against both the innerlielements (as you wanted), but also against the outerli(that contains those inner elements), so…not quite there, yet.And the above problem resolved! …in those browsers that support the CSS
:not()selector:JS Fiddle demo.
I forgot (originally) to note that for this to work (because CSS doesn’t have a parent selector (as yet) I had to add a specific class to those
lielements with childolelements in order to appropriately hide the duplication of the number. In this case I chose the class-name.hasChild(as can be seen in the Fiddle).Incidentally, a small change to the
li:not(.hasChild)::beforerules, allows for the right-aligned text:JS Fiddle demo.