Return to Snippet

Revision: 46838
at May 26, 2011 13:05 by mgthantzin


Initial Code
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;
}

Initial URL
http://www.456bereastreet.com/lab/styling-ordered-list-numbers/

Initial Description

                                

Initial Title
Styling ordered list numbers

Initial Tags

                                

Initial Language
CSS