I want to have an ordered list, using superscript, so something like this in my html:
<ol class="sup_n">
<li><p>Item 1</p></li>
<li><p>Item 2</p></li>
<li><p>Item 3</p><p>Item 3b</p></li>
</ol>
but having it appear as
1) Item 1
2) Item 2
3) Item 3a
Item 3b
However, existing solutions only show it working for list items that contain only text. The moment there is other content (spans, divs, p tags, images other listings and name it) the result is not exactly ok. Since my html contains a mixture of list 'styles', (some only text, some mixture of various tags) I'd like it to be flexible enough to deal with anything within the li tag as if it would be a 'normal' tag. I hope I make some sense, I'm not a real css wizard to be honest.
This is the code I used (structural idea found on above mentioned page, added styles for superscript):
ol.sup_n {
counter-reset: item;
margin: 0;
padding: 0;
list-style:none;
}
.sup_n li {
display: block;
margin-left: 1em;
}
.sup_n li:before {
content: counter(item) ")";
counter-increment: item;
display: inline-block;
text-align: right;
width: 3em;
padding-right: 0.5em;
margin-left: -3.5em;
vertical-align:super;
font-size:xx-small;
}
<ol class="sup_n">
<li><p>Item 1</p></li>
<li><p>Item 2</p></li>
<li><p>Item 3</p><p>Item 3b</p></li>
</ol>
but it only works fine if there are no sub elements in the list item. How can I make it work with multiple different elements in the li? The example is using only p tags but it can be different tags in reality. What would be the best approach to cover these?