Wednesday 13 May 2015

CSS: Custumize Order List

CSS mempunyai beberapa styling untuk list seperti list-style-type, list-style-image, and list-style-position

Akan tetapi untuk styling bullet and numberingnya seperti memberi background atau mengganti warna saja kita butuh styling lebih rumit. Hal tersebutlah yang akan dibahas.





Secara garis besar kita akan menggunakan property counter-increment dan pseudo element :before.


<!-- 
Add class to ol or ul
except you want to style every single list
-->
<ol class="custom-counter">
   <li>This is the first item</li>
   <li>This is the second item</li>
   <li>This is the third item</li>
   <li>This is the fourth item</li>
   <li>This is the fifth item</li>
   <li>This is the sixth item</li>
</ol>

See the Pen CSS: Custumize Order List by pras abdilah (@pras-abdilah) on CodePen.



Lalu bagaimana dengan bullet dalam <ul> ?


Sederhanaya cukup dengan memberi styling pada pseudo element ::before.


Related Link: