{"id":209,"date":"2011-05-09T17:17:03","date_gmt":"2011-05-09T17:17:03","guid":{"rendered":"http:\/\/www.sitekickr.com\/blog\/?p=209"},"modified":"2011-05-09T17:18:17","modified_gmt":"2011-05-09T17:18:17","slug":"stats-counter-styling-with-css","status":"publish","type":"post","link":"https:\/\/www.sitekickr.com\/blog\/stats-counter-styling-with-css\/","title":{"rendered":"Counter styling with CSS"},"content":{"rendered":"<p><img alt=\"\" src=\"http:\/\/www.sitekickr.com\/blog\/wp-content\/uploads\/2011\/05\/test.png\" \/><\/p>\n<p><strong>Key ingredients<br \/>\n\t<\/strong><\/p>\n<ol>\n<li>Background image, like the above<\/li>\n<li>Fixed-width font, like Courier<\/li>\n<li>CSS letter-spacing property<\/li>\n<li>Ability to zero-pad numbers with your server-side language<\/li>\n<\/ol>\n<p><strong>The HTML<br \/>\n\t<\/strong><code>&lt;div id=&quot;counter&quot;&gt;0003&lt;\/div&gt;<\/code><\/p>\n<p><strong>The CSS<\/strong><br \/><code><br \/>\n\t#counter {&nbsp; \/* adjust all styles below to fit your chosen font \/ size *\/ <br \/>\n\t&nbsp; width: 68px;<br \/>\n\t&nbsp; padding: 1px 0 3px 3px; <br \/>\n\t&nbsp; font-family: Courier;<br \/>\n\t&nbsp; font-size: 18px; <br \/>\n\t&nbsp; letter-spacing: 7px;<br \/>\n\t&nbsp; background: url(&#39;\/src\/img\/test.png&#39;) 0 0 repeat-x; }<\/code><\/p>\n<p><strong>Zero-Padding<\/strong><br \/>\n\tWith ColdFusion as an example, you might use the following code to zero-pad your counter:<\/p>\n<p><code>&lt;div id=&quot;counter&quot;&gt;&lt;cfoutput&gt;<br \/>\n\t&nbsp; #NumberFormat(hits, &quot;0009&quot;)#<br \/>\n\t&lt;\/cfoutput&gt;&lt;\/div&gt;<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Key ingredients Background image, like the above Fixed-width font, like Courier CSS letter-spacing property Ability to zero-pad numbers with your server-side language The HTML &lt;div&hellip;<\/p>\n","protected":false},"author":1,"featured_media":210,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"amp_status":""},"categories":[12],"tags":[90],"_links":{"self":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/209"}],"collection":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/comments?post=209"}],"version-history":[{"count":3,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/209\/revisions"}],"predecessor-version":[{"id":214,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/209\/revisions\/214"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/media\/210"}],"wp:attachment":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/media?parent=209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/categories?post=209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/tags?post=209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}