Is there any way I can automate the value of content of my pseudo element depending what the child number does the class is? I hope it make sense.
For example I have 10 items in my list then I have to put what place they are on the list into the content
using li:nth-child:before
I have to simple put 1, 2, 3, 4, 5... and so on until the last item is declared. which is not appropriate if the list have 100 items.
Is there any way this is possible only on CSS? if so possibly javascript or jquery might be good enough to provide the right solution.
HTML
CSS
ul.numeric {float:left; width:100%; list-style-type:none; position:relative;}
ul.numeric li {position:relative; padding-left:40px; line-height:40px;}
ul.numeric li:after { content: ''; position: absolute; display: inline-block; top: 0; left: 3px; line-height: 32px; width: 32px; height: 32px; padding: 0; background: url(/Images/star-yellow.png) left center no-repeat; background-size: 100%; font-size: 18px; text-align: center; color: #565656; font-family: Georgia, sans-serif;}
ul.numeric li:first-child:after {content:'1';}
ul.numeric li:nth-child(2):after {content:'2';}
ul.numeric li:nth-child(3):after {content:'3';}
ul.numeric li:nth-child(4):after {content:'4';}
ul.numeric li:nth-child(5):after {content:'5';}
ul.numeric li:nth-child(6):after {content:'6';}
Basically the current setup would only provide the right content value up to item 6 only.
FIddle available here