{"id":11186,"date":"2025-01-26T19:55:36","date_gmt":"2025-01-26T19:55:36","guid":{"rendered":"https:\/\/putridparrot.com\/blog\/?p=11186"},"modified":"2025-01-26T19:55:36","modified_gmt":"2025-01-26T19:55:36","slug":"css-units-of-measurement","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/css-units-of-measurement\/","title":{"rendered":"CSS units of measurement"},"content":{"rendered":"<p>CSS offers several types of units of measurement as part of your web design, i.e. for font sizes, spacing etc. <\/p>\n<p><strong>px (pixels)<\/strong><\/p>\n<p>If you&#8217;ve come from any other UI development you&#8217;ll probably be used to using pixels to define window sizes etc. Pixels allow us to specify positioning and sizes specifically, however these are not scalable, i.e. a 10px * 10px button might look fine on a lower resolution monitor but for a high resolution look tiny.<\/p>\n<p>1px = 1\/96th of an inch<\/p>\n<p><strong>cm<\/strong><\/p>\n<p>Centimetres, and absolute measurement, 1cm equals 37.8px, which equals 25.2\/64in<\/p>\n<p><strong>mm<\/strong><\/p>\n<p>Millimeters, 1mm = 1\/10th of 1 cm<\/p>\n<p><strong>Q<\/strong><\/p>\n<p>Quarter-millimeteres, 1Q = 1\/40th of a cm<\/p>\n<p><strong>in<\/strong><\/p>\n<p>Inches, 1 in = 2.54cm = 96px<\/p>\n<p><strong>pc<\/strong><\/p>\n<p>Picas, 1pc = 1\/6th of an inch<\/p>\n<p><strong>pt<\/strong><\/p>\n<p>Points, 1pc = 1\/72nd of an inch<\/p>\n<p><strong>em<\/strong><\/p>\n<p>This is a unit which is relative to the font size of the parent element. So for example 3em will be twice the size of the parent element&#8217;s font size. In other words let&#8217;s assume the font size is 32px then 3em would be 3 * 32px, i.e. 96px. <\/p>\n<p><strong>rem (root em)<\/strong><\/p>\n<p>This is similar (as the name suggests) to em, but it&#8217;s relative to the root HTML font size. Otherwise we can calculate things as per em, but using the root font size not the parent element.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CSS offers several types of units of measurement as part of your web design, i.e. for font sizes, spacing etc. px (pixels) If you&#8217;ve come from any other UI development you&#8217;ll probably be used to using pixels to define window sizes etc. Pixels allow us to specify positioning and sizes specifically, however these are not [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[43],"tags":[],"class_list":["post-11186","post","type-post","status-publish","format-standard","hentry","category-css"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/11186","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=11186"}],"version-history":[{"count":2,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/11186\/revisions"}],"predecessor-version":[{"id":11188,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/11186\/revisions\/11188"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=11186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=11186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=11186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}