CSS override of Ordered List Block not reading starting values
-
I’m using the below code on my website to display the List Items the way I want; it works and looks great. The problem is it ignores the Starting Value defined in a list block, so if I want to start a list at a value of 13, the editor shows it as 13, but the published page shows it as 1 (e.g. it resets every block no matter what starting value I define).
My guess is this is due to a missing set-counter (or something similar) — the problem is I don’t know what the element is called from the WordPress block the list is from, or how to adjust the global CSS to inherit that “starting value” element when it’s defined (and just start at 1 when it’s not).
Any help would be appreciated. Thanks!
/* === Custom List Settings === */ ol { counter-reset:li; /* Initiate a counter */ margin-left:0; /* Remove the default left margin */ padding-left:0; /* Remove the default left padding */ } 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; /* Add some spacing around the content */ list-style:none; /* Disable the normal item numbering */ border-top:2px solid #272727; border-left:2px solid #272727; background:#0e1014; } 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; -moz-box-sizing:border-box; -webkit-box-sizing:border-box; box-sizing:border-box; width:2em; /* Some space between the number and the content in browsers that support generated content but not positioning it (Camino 2 is one example) */ margin-right:8px; padding:4px; border-top:2px solid #272727; border-right:2px solid #272727; color:#fff; background:#0e1014; font-weight:bold; font-family:"Helvetica Neue", Arial, sans-serif; text-align:center; } li ol, li ul {margin-top:6px;} ol ol li:last-child {margin-bottom:0;}
- The topic ‘CSS override of Ordered List Block not reading starting values’ is closed to new replies.