{"id":726,"date":"2012-08-24T16:00:14","date_gmt":"2012-08-24T16:00:14","guid":{"rendered":"http:\/\/www.sitekickr.com\/blog\/?p=726"},"modified":"2012-08-24T16:00:14","modified_gmt":"2012-08-24T16:00:14","slug":"css-before-pseudo","status":"publish","type":"post","link":"https:\/\/www.sitekickr.com\/blog\/css-before-pseudo\/","title":{"rendered":"Think :before you markup"},"content":{"rendered":"<p>Some of the most-intriguing and useful CSS tools have been around since CSS 2.0, but perhaps are a bit underused. Part of the reason is that IE 7 and below doesn&#39;t support many of them. The other part is simply that we forget about them!<\/p>\n<p>Let&#39;s take the :before and :after pseudo-elements for example. These are very useful when we need to adjust the display of markup, without manually adding tons of symbols and prefixes to our HTML.<\/p>\n<p>But, the other long-forgotten reason for using :before and :after is that it maintains the selectability of content for copy\/paste operations.<\/p>\n<p>Using a table of cost data for example:<\/p>\n<table>\n<thead><\/thead>\n<tbody>\n<tr>\n<td>Part 1<\/td>\n<td>199.99<\/td>\n<\/tr>\n<tr>\n<td>Part 2<\/td>\n<td>299.99<\/td>\n<\/tr>\n<tr>\n<td>Part 3<\/td>\n<td>399.99<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>By applying the following CSS:<\/p>\n<p><code>table td + td:before { content: &#39;$&#39;; }<\/p>\n<p>\t<\/code><\/p>\n<p>We suddenly have:<\/p>\n<p><a href=\"http:\/\/www.sitekickr.com\/blog\/wp-content\/uploads\/2012\/08\/table-cost.jpg\"><img loading=\"lazy\" alt=\"\" class=\"alignnone size-full wp-image-727\" height=\"55\" src=\"http:\/\/www.sitekickr.com\/blog\/wp-content\/uploads\/2012\/08\/table-cost.jpg\" title=\"table-cost\" width=\"94\" \/><\/a><\/p>\n<p>Which maintains our existing markup, while allowing the user to copy\/paste the values without the dollar signs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Some of the most-intriguing and useful CSS tools have been around since CSS 2.0, but perhaps are a bit underused. Part of the reason is&hellip;<\/p>\n","protected":false},"author":1,"featured_media":727,"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\/726"}],"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=726"}],"version-history":[{"count":1,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/726\/revisions"}],"predecessor-version":[{"id":728,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/posts\/726\/revisions\/728"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/media\/727"}],"wp:attachment":[{"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/media?parent=726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/categories?post=726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sitekickr.com\/blog\/wp-json\/wp\/v2\/tags?post=726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}