In my previous question, I've been using CSS to create auto generated list numbering for <li></li>
tags. In another task, I need to create another list that will have title in between of the list as picture shown below.
Above example can be achieve using below code
HTML
<ol class="main">
<span class="title">Title</span>
<li>
Content
</li>
<li>
Content
</li>
<span class="title">Title</span>
<li>
Content
</li>
</ol>
CSS
ul {counter-reset:section}
li {margin:15px 0;text-align:justify}
li:before {counter-increment:section;content:""}
.main {list-style-position:inside;list-style-type:none;padding:0}
.main span {font-weight:700;text-decoration:underline}
.inner {padding:0}
.inner ul {counter-reset:section}
.inner ul > li:before {content:""}
ul {list-style-type:lower-alpha}
However, this code doesn't work in some browser like Opera. This is because in HTML 5, <span></span>
tag can't be nested within element <ol></ol>
.
jsFiddle that work in Firefox, Chrome and Internet Explorer.