I need to implement the following list style:
01 Item 1
02 Item 2
02a Item 2a
02b Item 2b
03 Item 3
How can I get the counter value of the parent to use in the :before content of my sub item? (02 in my above example)
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.
You use two different counters: one for the
liparents and one for thelisubitems. Then, in eachlisubitem, concatenate multiplecounter()functions using each counter, like this:jsFiddle demo, tested in all browsers that support
:beforeand CSS2.1 counters including IE8+Useful reading: W3C CSS2.1 generated content spec, §12.4.1 Nested counters and scope