I need to do a CSS that supports a special bullet via the use of li::before as well as ordered lists that vary depending on their depth. My problem is that the use of li::before is causing a conflict between the <UL>
and the <OL>
versions.
<div class='div'>
LI...
<li>Bullet1</li>
<li>Bullet2</li>
<HR>
UL...
<ul>
<li>Bullet3</li>
<li>Bullet4</li>
<ul>
<li>Bullet5
</li>
</ul>
</ul>
<HR>
OL....
<ol>
<li>Number1</li>
<li>Number2</li>
</ol>
<HR>
OL...OL/UL...
<ol>
<li>Number3</li>
<ol>
<li>Number3.1</li>
<ul>
<li>Bullet6</li>
</ul>
<ol>
<li>Number3.1.1</li>
</ol>
</ol>
<ul>
<li>Bullet7</li>
</ul>
</ol>
</div>
I'm using the following CSS
ol,ul {
margin:5px 1px;
padding-inline-start:21px;
padding-bottom:1px;
}
ol ul + h1,h2,h3,h4,h5,h6,p {
padding-top:0;
}
.div ol > li {
line-height:1.5em;
margin-left:0;
padding-left:0;
}
.div ul > ol {
list-style-type: lower-alpha;
padding-inline-start:18px;
}
.div ol > ol {
list-style-type: lower-alpha;
padding-inline-start:18px;
}
.div ul > ul > ol {
list-style-type: lower-roman;
padding-inline-start:23px;
padding-left:25px;
}
.div ol > ol > ol {
list-style-type: lower-roman;
padding-inline-start:23px;
padding-left:25px;
}
.div ol > ul > ol {
list-style-type: lower-roman;
padding-inline-start:23px;
padding-left:25px;
}
.div ol > ol > ul > li {
content:"▶"!important;
color:green!important;
}
.div ul > li {
line-height:1.4em;
}
.div > li {
line-height:1.4em;
margin-left:0;
}
.div li + li { /* This is the gap between LI bullets */
margin-top:8px;
}
.div ul>li, .div>li {
list-style-type:square;
display:table;
border-spacing:0;
}
.div ol li::marker {
color: #866767;
font-weight:600;
font-size:90%;
}
.div ol li::before {
content:unset;
}
.div ul {
list-style-position: outside;
padding:0;
margin:0 0 0 23px;
}
.div li::before {
content:"▶";
list-style-type: none;
color:red;
font-size:15pt;
font-weight:bold;
padding:1px 10px 0 0;
line-height:18px;
display:table-cell;
vertical-align:top;
xmargin-left:-20px;
}
.div ul + * {
margin-top:15px;
}
I can't seem to get Bullet6 to have a triangle bullet as seen in the other Bullets1-5 Where am I going wrong?
A working version of the code can be found on https://jsfiddle.net/Abeeee/2a6br3yj/27/
& ol should be inside- s.
– Reed Jun 14 '21 at 16:07. BUT that's also nested within an
so i think the ::before is catching the `ol li` and having content `unset`
– Reed Jun 14 '21 at 16:12or
, not