Reputation: 2953
I want to create a UL LI decimal list style and a number should be inside a circle like image below.
Do you have any idea?
ul {
border-left: 1px solid $black;
// background-color: #f1f1f1;
list-style-type: none;
list-style: decimal;
padding-left: 8px;
}
<ul>
<li>Sed ut perspiciatis unde omnis iste natus</li>
<li>error sit voluptatem accusantium doloremque</li>
<li>Sed ut perspiciatis unde omnis iste natus</li>
<li>error sit voluptatem accusantium doloremque</li>
</ul>
Upvotes: 0
Views: 63
Reputation: 2633
For this you can't use the predefined list styles, but you can play with the before elements. Also, you'll have to switch to a <ol>
because of the numbers. Here, check out this example below.
As for the decimal part, you can probably make a mix between what I show you and this question's accepted answer and second best answer.
ol.special {
counter-reset: li;
margin-left: 0;
padding-left: 0;
position: relative;
margin-left: 1rem;
}
ol.special::before {
width: 1px;
background-color: black;
content: " ";
position: absolute;
top: 0.8rem;
bottom: 0.8rem;
}
ol.special li {
position: relative;
margin: 0 0 0rem 0;
padding: 0.5rem 0 0.5rem 1rem;
list-style: none;
}
ol.special li::before {
content: counter(li);
counter-increment: li;
border-radius: 1rem;
background-color: white;
color: black;
width: 1.25rem;
height: 1.25rem;
display: inline-block;
text-align: center;
margin-right: 0.5rem;
margin-left: -1.7rem;
border: solid 1px black;
font-weight: bold
}
<ol class="special">
<li>Element number 1</li>
<li>Element number 2</li>
<li>Element number 3</li>
<li>Element number 4</li>
<li>Element number 5</li>
<li>Element number 6</li>
</ol>
Upvotes: 5