Last active
December 26, 2015 14:48
-
-
Save SebAshton/7167923 to your computer and use it in GitHub Desktop.
proper numbering of nested ol's
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<title>Nested ol numbering</title> | |
<style> | |
ol { | |
list-style-type: none; | |
counter-reset: level1; | |
} | |
ol li:before { | |
content: counter(level1) ". "; | |
counter-increment: level1; | |
} | |
ol li ol { | |
list-style-type: none; | |
counter-reset: level2; | |
} | |
ol li ol li:before { | |
content: counter(level1) "." counter(level2) " "; | |
counter-increment: level2; | |
} | |
ol li ol li ol li:before { | |
content: counter(level1) "." counter(level2) "." counter(level3) " "; | |
counter-increment: level3; | |
} | |
ol li span { /* For IE6/7. */ | |
margin: 0 5px 0 -25px; | |
} | |
</style> | |
</head> | |
<body> | |
<ol> | |
<li>first</li> | |
<li>second | |
<ol> | |
<li>second nested first element</li> | |
<li>second nested second element</li> | |
<li>second nested third element</li> | |
</ol> | |
</li> | |
<li>third</li> | |
<li>fourth</li> | |
</ol> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment