This is my CSS and HTML:
.moving-steps > li:before {
background: none repeat scroll 0 0 #8F8888;
border-radius: 15px;
color: #FFFFFF;
counter-increment: headings 1;
content: counter(headings, decimal);
display: block;
float: left;
font-size: 16px;
font-weight: bold;
height: 25px;
line-height: 26px;
margin-bottom: 0;
margin-right: 5px;
text-indent: 8px;
width: 25px;
}
<ul class="moving-steps">
<li></li>
<li></li>
<li></li>
</ul>
This code is not working.
counter-increment: headings 1;
content: counter(headings, decimal);
This inserts 1
every time, what am I missing?
Definition and Usage The counter-increment property increases or decreases the value of one or more CSS counters. The counter-increment property is usually used together with the counter-reset property and the content property. Default value: none.
The counter-reset CSS property resets a CSS counter to a given value. This property will create a new counter or reversed counter with the given name on the specified element. Normal counters have a default initial value of 0.
Steps to create HTML counter Step 1: Create the simple structure using HTML <div> tags. Step 2: Add CSS to make the counter more attractive. Step 3: To add the small icons (like suitcase, coffee-cup, Smylie, user icon, book and more) with the counter, use the bootstrap cdn link and code.
The counter-increment CSS property increases or decreases the value of a CSS counter by a given value.
You should have this css on the ul
itself:
.moving-steps {
counter-reset: headings;
}
and counter-increment
should only contain headings
:
.moving-steps > li:before {
counter-increment: headings;
}
Check out this JS Fiddle:
.moving-steps {
counter-reset: headings;
list-style: none;
}
.moving-steps > li:before {
background: none repeat scroll 0 0 #8F8888;
border-radius: 15px;
color: #FFFFFF;
counter-increment: headings;
content: counter(headings, decimal);
display: block;
float: left;
font-size: 16px;
font-weight: bold;
height: 25px;
line-height: 26px;
margin-bottom: 0;
margin-right: 5px;
text-indent: 8px;
width: 25px;
}
<ul class="moving-steps">
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ul>
Just Add the following style additionally
body{counter-reset: headings;}
then the value will be increment
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With