{"id":28999,"date":"2017-03-22T03:01:36","date_gmt":"2017-03-21T17:01:36","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=28999"},"modified":"2025-02-21T12:21:50","modified_gmt":"2025-02-21T02:21:50","slug":"wordpress-ordered-list-css-styling-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-ordered-list-css-styling-primer-tutorial\/","title":{"rendered":"WordPress Ordered List CSS Styling Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/wordpress_ol.jpg\" rel=\"noopener\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"WordPress Ordered List CSS Styling Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/wordpress_ol.jpg\" title=\"WordPress Ordered List CSS Styling Primer Tutorial\"   \/><\/a><p class=\"wp-caption-text\">WordPress Ordered List CSS Styling Primer Tutorial<\/p><\/div>\n<p>We&#8217;ve had a couple of blog postings, in a row, recently, involving fairly long HTML <i>ol<\/i> tag &#8220;ordered lists&#8221;.  This set us to thinking about CSS styling we could use for these &#8220;ordered lists&#8221;.<\/p>\n<p>Our first pass of thinking involving thoughts of using Emoji number characters bounded by Emoji &#8220;button borders&#8221; ended up butting up against web browser compatibility issues, working for Safari, but not for Chrome nor Opera nor Firefox, because our CSS selector solution involved the <b>negation pseudo element<\/b> snippet as per &#8230;<\/p>\n<p><code><br \/>\nol li<b>:not(ul&gt;li)<\/b>:nth-of-type(2)::before { background-color:#f0c0c0; content:'\\000032<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\n<\/code><\/p>\n<p> &#8230; where that <b>:not(<i>ul>li<\/i>)<\/b> usage above awaits the application of the current level 4 (CSS) definition in all web browsers (because <b><i>ul>li<\/i><\/b> does not satisfy the definition of a <i>simple selector<\/i> for some web browsers), as we found out about at this <a target=\"_blank\" title='Useful link' href='http:\/\/stackoverflow.com\/questions\/35993727\/not-selector-not-behaving-the-same-between-safari-and-chrome-firefox' rel=\"noopener\">useful link<\/a> and this <a target=\"_blank\" title='Other useful link' href='https:\/\/drafts.csswg.org\/selectors-4\/#negation' rel=\"noopener\">other useful link<\/a>.<\/p>\n<p>And so to compromise for those non-Safari web browsers, rather than waiting the other way around <font size=-1> &#8230; sun goes up, sun comes down, many times methinks &#8230; <\/font> we preface CSS like above with a more generic CSS <b>snippet<\/b> up above the new bits of CSS written into the WordPress TwentyTen theme&#8217;s good ol&#8217; header.php &#8230;<\/p>\n<p><code><br \/>\n&lt;style&gt;<br \/>\n<b>ol { counter-reset: item; }<br \/>\nol&gt;li { display: block; }<br \/>\nol&gt;li:before { content:  \"  \" counter(item) \" \"; counter-increment: item; color: #1f1f1f; background-color: #f0f0f0; border:1px solid olive; }<\/b><br \/>\nol li:not(ul&gt;li):nth-of-type(1) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(2) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(3) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(4) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(5) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(6) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(7) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(8) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(9) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(10) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(11) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(12) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(13) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(14) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(15) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(16) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(17) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(18) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(19) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(20) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(21) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(22) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(23) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(24) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(25) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(26) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(27) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(28) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(29) { list-style: none;  }<br \/>\nol li:not(ul&gt;li):nth-of-type(30) { list-style: none;  }<br \/>\n<b><\/b><br \/>\n<b><\/b><br \/>\nol li:not(ul&gt;li):nth-of-type(1)::before { background-color:#f0c0c0; content:'\\000031<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(2)::before { background-color:#f0c0c0; content:'\\000032<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(3)::before { background-color:#f0c0c0; content:'\\000033<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(4)::before { background-color:#f0c0c0; content:'\\000034<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(5)::before { background-color:#f0c0c0; content:'\\000035<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(6)::before { background-color:#f0c0c0; content:'\\000036<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(7)::before { background-color:#f0c0c0; content:'\\000037<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(8)::before { background-color:#f0c0c0; content:'\\000038<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(9)::before { background-color:#f0c0c0; content:'\\000039<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(10)::before { background-color:#f0c0c0; content:'\\000031<font color=blue>\\00fe0f<\/font>\\0020e3\\000030<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(11)::before { background-color:#f0c0c0; content:'\\000031<font color=blue>\\00fe0f<\/font>\\0020e3\\000031<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(12)::before { background-color:#f0c0c0; content:'\\000031<font color=blue>\\00fe0f<\/font>\\0020e3\\000032<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(13)::before { background-color:#f0c0c0; content:'\\000031<font color=blue>\\00fe0f<\/font>\\0020e3\\000033<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(14)::before { background-color:#f0c0c0; content:'\\000031<font color=blue>\\00fe0f<\/font>\\0020e3\\000034<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(15)::before { background-color:#f0c0c0; content:'\\000031<font color=blue>\\00fe0f<\/font>\\0020e3\\000035<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(16)::before { background-color:#f0c0c0; content:'\\000031<font color=blue>\\00fe0f<\/font>\\0020e3\\000036<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(17)::before { background-color:#f0c0c0; content:'\\000031<font color=blue>\\00fe0f<\/font>\\0020e3\\000037<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(18)::before { background-color:#f0c0c0; content:'\\000031<font color=blue>\\00fe0f<\/font>\\0020e3\\000038<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(19)::before { background-color:#f0c0c0; content:'\\000031<font color=blue>\\00fe0f<\/font>\\0020e3\\000039<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(20)::before { background-color:#f0c0c0; content:'\\000032<font color=blue>\\00fe0f<\/font>\\0020e3\\000030<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(21)::before { background-color:#f0c0c0; content:'\\000032<font color=blue>\\00fe0f<\/font>\\0020e3\\000031<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(22)::before { background-color:#f0c0c0; content:'\\000032<font color=blue>\\00fe0f<\/font>\\0020e3\\000032<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(23)::before { background-color:#f0c0c0; content:'\\000032<font color=blue>\\00fe0f<\/font>\\0020e3\\000033<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(24)::before { background-color:#f0c0c0; content:'\\000032<font color=blue>\\00fe0f<\/font>\\0020e3\\000034<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(25)::before { background-color:#f0c0c0; content:'\\000032<font color=blue>\\00fe0f<\/font>\\0020e3\\000035<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(26)::before { background-color:#f0c0c0; content:'\\000032<font color=blue>\\00fe0f<\/font>\\0020e3\\000036<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(27)::before { background-color:#f0c0c0; content:'\\000032<font color=blue>\\00fe0f<\/font>\\0020e3\\000037<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(28)::before { background-color:#f0c0c0; content:'\\000032<font color=blue>\\00fe0f<\/font>\\0020e3\\000038<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(29)::before { background-color:#f0c0c0; content:'\\000032<font color=blue>\\00fe0f<\/font>\\0020e3\\000039<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\nol li:not(ul&gt;li):nth-of-type(30)::before { background-color:#f0c0c0; content:'\\000033<font color=blue>\\00fe0f<\/font>\\0020e3\\000030<font color=blue>\\00fe0f<\/font>\\0020e3'; }<br \/>\n&lt;\/style&gt;<br \/>\n<\/code><\/p>\n<p>And so we hope the result is a better looking WordPress ordered list <a target=\"_blank\" href=\"http:\/\/www.rjmprogramming.com.au\/wordpress\/wordpress_ol.jpg\" title='Click picture' rel=\"noopener\">look<\/a>.<\/p>\n<p><b><i>Stop Press &#8230; 21 February, 2025 <font size=1>&#8230; believe it, or not<\/font><\/i><\/b><\/p>\n<p>It took a long time to tweak to <font color=blue>better look<\/font>.  Sorry <font size=1>for the long delay, regarding better looking keycaps<\/font> &#8230; and thanks to <a target=\"_blank\" href='https:\/\/www.iemoji.com\/view\/emoji\/295\/symbols\/keycap-1' rel=\"noopener\">this link<\/a> regarding the &#8220;final awakening&#8221;.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d28999' onclick='var dv=document.getElementById(\"d28999\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/css\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d28999' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve had a couple of blog postings, in a row, recently, involving fairly long HTML ol tag &#8220;ordered lists&#8221;. This set us to thinking about CSS styling we could use for these &#8220;ordered lists&#8221;. Our first pass of thinking involving &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/wordpress-ordered-list-css-styling-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,37],"tags":[151,275,276,281,385,2154,932,997,2128,1953,1212,1319,1324,1325,1456],"class_list":["post-28999","post","type-post","status-publish","format-standard","hentry","category-elearning","category-tutorials","tag-blog","tag-cross-browser","tag-cross-browser-issues","tag-css","tag-emoji","tag-ordered-list","tag-php","tag-programming","tag-pseudo-element","tag-selector","tag-styling","tag-tutorial","tag-twentyten","tag-twentyten-theme","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/28999"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=28999"}],"version-history":[{"count":6,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/28999\/revisions"}],"predecessor-version":[{"id":67021,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/28999\/revisions\/67021"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=28999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=28999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=28999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}