/ Published in: CSS
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
ol { counter-reset:li; /* Initiate a counter */ padding:0; /* Remove the default left padding */ list-style:none; /* Disable the normal item numbering */ } ol li { position:relative; /* Create a positioning context */ margin:0 0 6px 2em; /* Give each list item a left margin to make room for the numbers */ padding:4px 8px; border-top:2px solid #666; background:#f6f6f6; } ol li:before { content:counter(li); /* Use the counter as content */ counter-increment:li; /* Increment the counter by 1 */ /* Position and style the number */ position:absolute; top:-2px; left:-2em; width:2em; padding:4px 0; border-top:2px solid #666; color:#fff; background:#666; font-weight:bold; font-family:"Helvetica Neue", Arial, sans-serif; text-align:center; }
URL: http://www.456bereastreet.com/lab/styling-ordered-list-numbers/