{"id":10,"date":"2007-01-24T22:18:46","date_gmt":"2007-01-24T22:18:46","guid":{"rendered":"http:\/\/www.unicursalpath.co.uk\/wordpress\/?p=10"},"modified":"2013-08-15T22:14:24","modified_gmt":"2013-08-15T21:14:24","slug":"rounded-corners-tidy-code","status":"publish","type":"post","link":"https:\/\/www.unicursalpath.co.uk\/wordpress\/rounded-corners-tidy-code\/","title":{"rendered":"Rounded corners, tidy code"},"content":{"rendered":"<p>This technique is no longer needed &#8211; we have HTML5 and CSS3 and support for border-radius now.<\/p>\n<hr \/>\n<p>There are many techniques for putting rounded corners on a box. All of them require some deviation from the ideal of clean, semantic (X)HTML for structure, CSS for presentation and scripting for behaviour. <\/p>\n<p>The technique of placing corner images directly in a page goes against the idea that CSS should be used for presentation and reduces flexibility (no style-switching). Techniques that use JavaScript seem like overkill to me, and the resulting page code is often the same anyway. <\/p>\n<p>Best let CSS handle it. The cleanest and most concise way I have found uses four &#60;div&#62; elements to call the corner images from a stylesheet. <\/p>\n<h2>The code for the page.<\/h2>\n<p><code>&#60;div id=&quot;container&quot;&#62;<br \/>\n&#60;div class=&quot;nw&quot;&#62;&#60;!-- --&#62;&#60;div class=&quot;ne&quot;&#62;&#60;!-- --&#62;&#60;\/div&#62;&#60;\/div&#62;<br \/>\n&#60;p&#62;Content&#60;\/p&#62;<br \/>\n&#60;div class=&quot;sw&quot;&#62;&#60;!-- --&#62;&#60;div class=&quot;se&quot;&#62;&#60;!-- --&#62;&#60;\/div&#62;&#60;\/div&#62;<br \/>\n&#60;\/div&#62;<\/code><\/p>\n<h2>The code for the stylesheet.<\/h2>\n<p><code>.nw, .ne, .sw, .se { height: 15px; }<br \/>\n.nw { background: url(nw.gif) no-repeat top left; }<br \/>\n.ne { background: url(ne.gif) no-repeat top right; }<br \/>\n.sw { background: url(sw.gif) no-repeat bottom left; }<br \/>\n.se { background: url(se.gif) no-repeat bottom right; }<\/code><\/p>\n<p>Pretty straightforward. Using empty &#60;div&#62; elements for presentation like this looks a bit messy but I do not think it is incorrect. The comments are added because some browsers will add default dimensions to an empty &#60;div&#62;. The &#60;div&#62; elements are nested so that there is no need to declare a width on the classes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This technique is no longer needed &#8211; we have HTML5 and CSS3 and support for border-radius now. There are many techniques for putting rounded corners on a box. All of them require some deviation from the ideal of clean, semantic (X)HTML for structure, CSS for presentation and scripting for behaviour. The technique of placing corner [&hellip;]<\/p>\n","protected":false},"author":183,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[10,11],"class_list":["post-10","post","type-post","status-publish","format-standard","hentry","category-web-design","tag-css","tag-web-design-2"],"_links":{"self":[{"href":"https:\/\/www.unicursalpath.co.uk\/wordpress\/wp-json\/wp\/v2\/posts\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.unicursalpath.co.uk\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.unicursalpath.co.uk\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.unicursalpath.co.uk\/wordpress\/wp-json\/wp\/v2\/users\/183"}],"replies":[{"embeddable":true,"href":"https:\/\/www.unicursalpath.co.uk\/wordpress\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":8,"href":"https:\/\/www.unicursalpath.co.uk\/wordpress\/wp-json\/wp\/v2\/posts\/10\/revisions"}],"predecessor-version":[{"id":193,"href":"https:\/\/www.unicursalpath.co.uk\/wordpress\/wp-json\/wp\/v2\/posts\/10\/revisions\/193"}],"wp:attachment":[{"href":"https:\/\/www.unicursalpath.co.uk\/wordpress\/wp-json\/wp\/v2\/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.unicursalpath.co.uk\/wordpress\/wp-json\/wp\/v2\/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.unicursalpath.co.uk\/wordpress\/wp-json\/wp\/v2\/tags?post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}