{"id":139767,"date":"2018-06-04T12:00:31","date_gmt":"2018-06-04T17:00:31","guid":{"rendered":"https:\/\/getflywheel.com\/?p=27469"},"modified":"2024-09-29T12:21:44","modified_gmt":"2024-09-29T17:21:44","slug":"choose-css-unit-create-better-site-layouts-how-to","status":"publish","type":"resource","link":"https:\/\/wpengine.com\/case-studies\/resources\/choose-css-unit-create-better-site-layouts-how-to\/","title":{"rendered":"How to Choose the Best CSS Unit to Create Better Site Layouts"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">CSS units are one of the most fundamental aspects to consider while creating a site layout. These units will define how your design will interact on various devices.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But when it comes to CSS units, there are many options to choose from and all options are not equal. CSS units are not limited to fonts only, so as a front-end developer, you should understand how these units affect layouts, also.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this article, we&#8217;ll show you how different CSS units work, so you can use them to create better layouts and site designs. Here&#8217;s what we&#8217;ll cover:<\/p>\n\n\n\n\n\n<h2 class=\"wp-block-heading\">Types of CSS units<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">CSS units can be separated in the following categories:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Absolute CSS units<\/li>\n\n\n\n<li>Font relative CSS units<\/li>\n\n\n\n<li>Viewport relative CSS units<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Absolute CSS units<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Some CSS units depend on certain absolute values and are not affected by any screen size or fonts. These units display may vary depending on different screen resolutions, as they depend on DPI (dots per inch) of screens.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These units are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>px (pixels)<\/li>\n\n\n\n<li>in (inches)<\/li>\n\n\n\n<li>cm (centimeter)<\/li>\n\n\n\n<li>mm (millimeter)<\/li>\n\n\n\n<li>pc (picas)<\/li>\n\n\n\n<li>pt (points)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Pixels<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Pixels are the most commonly used and accepted CSS unit. And it\u2019s considered the base of measurement for many other units. It provides the most consistent result among various devices.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>box<\/code> element in the following example has a height of 150px and width of 150px, and it will remain the same on all screen sizes.<\/p>\n\n\n<p>[css]<br \/>\n.box{<br \/>\nheight:150px;<br \/>\nwidth:150px;<br \/>\n}<br \/>\n[\/css]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">All other absolute units like in (inches), cm (centimeter) and mm (millimeter) are real-world measurement units with very little real-world CSS use cases.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It\u2019s still good to understand their relationship to pixels, however, so this is how they compare:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>1in = 96px<\/li>\n\n\n\n<li>1cm = 37.8px<\/li>\n\n\n\n<li>1mm = 3.78px<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">While pc (picas) and pt (points) are directly related to inches.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>1in = 72pt<\/li>\n\n\n\n<li>1in = 6pc<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/getflywheel-images.s3.us-east-2.amazonaws.com\/uploads\/2018\/05\/flywheel-unit-conversions-01.png\" alt=\"CSS units comparison\" class=\"wp-image-27751\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The relation between all absolute units can be demonstrated like this:<br><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Rem<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Apart from pixels, all other absolute units have very little to no use cases for screen CSS, but since they are real-world measurement units, they can be effectively used in print CSS. (In case you are wondering about pixels, they work fine in print CSS as well!)<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Font-relative CSS units<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">There are some CSS units which depend on the font size or font family of the document or its parent level elements. This includes units like:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>em<\/li>\n\n\n\n<li>rem<\/li>\n\n\n\n<li>ex<\/li>\n\n\n\n<li>ch<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Em<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Em is a relative length unit; it depends on the font size of the parent element or the document. By default, <code>1em<\/code> is equal to <code>16px<\/code> if is no <code>font-size<\/code> is defined.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Em inherits size from its immediate parent\u2019s font size. So, if a parent element has <code>font-size:18px<\/code>, then <code>1em<\/code> will be measured as <code>18px<\/code> for all its child&#8217;s.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here we have a div <code>.post<\/code> with three childs, <code>.post-item<\/code>, with a title and some text.<\/p>\n\n\n<p>[html]<br \/>\n&lt;div class=&#8221;post&#8221;&gt;<br \/>\n&lt;div class=&#8221;post-item&#8221;&gt;<br \/>\n&lt;h2&gt;Title&lt;\/h2&gt;<br \/>\nLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry&#8217;s standard dummy text ever since the 1500s<br \/>\n&lt;\/div&gt;<br \/>\n&lt;div class=&#8221;post-item&#8221;&gt;<br \/>\n&lt;h2&gt;Title&lt;\/h2&gt;<br \/>\nLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry&#8217;s standard dummy text ever since the 1500s<br \/>\n&lt;\/div&gt;<br \/>\n&lt;div class=&#8221;post-item&#8221;&gt;<br \/>\n&lt;h2&gt;Title&lt;\/h2&gt;<br \/>\nLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry&#8217;s standard dummy text ever since the 1500s<br \/>\n&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n[\/html]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now the parent <code>.post<\/code> has a <code>font-size:20px<\/code> and the child element <code>.post div<\/code> has its own <code>font-size:1.2em<\/code> with <code>padding:0.75em<\/code> and <code>margin:0.75em<\/code>, so the computed padding and margin will be 18px (20px*1.2em*0.75em).<\/p>\n\n\n<p>[css]<br \/>\nhtml{<br \/>\nfont-size:20px;<br \/>\n}<\/p>\n<p>.post{<br \/>\nfont-size:20px;<br \/>\n}<\/p>\n<p>.post div{<br \/>\nfont-size:1.2em;<br \/>\n}<\/p>\n<p>.post-item{<br \/>\nbackground:pink;<br \/>\npadding:0.75em;<br \/>\nmargin:0.75em;<br \/>\n}<\/p>\n<p>.post-item h2{<br \/>\nfont-size:1.5em;<br \/>\nmargin:0.5em 0;<br \/>\n}<\/p>\n<p>.post-item p{<br \/>\nmargin:0;<br \/>\nfont-size: 1em;<br \/>\n}<br \/>\n[\/css]<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/getflywheel-images.s3.us-east-2.amazonaws.com\/uploads\/2018\/05\/image2-662x347.jpg\" alt=\"3 identical css units with a large Title and smaller Lorem Ipsum filler text\" class=\"wp-image-27751\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">As you can see, the child elements are inheriting values from the parent.<br><br>The advantage of using em is, if you decide to change the <code>font-size<\/code>, <code>padding<\/code>, and <code>margin<\/code> of each element proportionately, then you just have to change the parent element font size and all other elements will adjust accordingly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That won&#8217;t be the case with absolute units like px, where you have to adjust each element individually.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This inheritance nature can be a bit tricky to manage, however, if nested elements have their own <code>font-size<\/code> in em, too.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Like in the previous demo, if you wrap the title and paragraph inside another <code>div<\/code> in one of the child items, you\u2019ll will see strange results.<\/p>\n\n\n<p>[html]<br \/>\n&lt;div class=&#8221;post-item&#8221;&gt;<br \/>\n&lt;div&gt;<br \/>\n&lt;h2&gt;Title&lt;\/h2&gt;<br \/>\nLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry&#8217;s standard dummy text ever since the 1500s<br \/>\n&lt;\/div&gt;<br \/>\n&lt;\/div&gt;<br \/>\n[\/html]<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/getflywheel-images.s3.us-east-2.amazonaws.com\/uploads\/2018\/05\/image1-662x366.jpg\" alt=\"Visual illustration of 3 CSS units demonstrating best practices, featuring a prominent title and Lorem Ipsum content for reference. Notably, the CSS unit in the center displays a slightly larger Lorem Ipsum text compared to the top and bottom units.\" class=\"wp-image-27751\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Because <code>post-item<\/code> has a nested <code>div<\/code>, the base size will change from 24px to 28.8px (20px*1.2em*1.2em), and <code>font-size<\/code> and <code>margin<\/code> for <code>h2<\/code> will change to 43.2px (20px*1.2em*1.2em*1.5em) and 14.4px (20px*1.2em*1.2em*0.5em), respectively.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Rem<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Rem can be really helpful in these types of situations because they always refer to the root element font size, not the parent element.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you take the previous example and change the units from em to rem for <code>.post div<\/code>, you\u2019ll see all child elements fix themselves.<\/p>\n\n\n<p>[css]<br \/>\n.post div{<br \/>\nfont-size:1.2rem;<br \/>\n}<br \/>\n[\/css]<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once the unit is changed from em to rem, its base changes from parent div to root element, which has a <code>front-size:20px<\/code>.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/getflywheel-images.s3.us-east-2.amazonaws.com\/uploads\/2018\/05\/image2-662x347.jpg\" alt=\"3 identical css units with a large Title and smaller Lorem Ipsum filler text\" class=\"wp-image-27751\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">So, the calculation will be 20px*1.2rem*value and &nbsp;<code>h2<\/code> and <code>p<\/code> both will have consistent <code>font-size<\/code> and <code>margin<\/code>, regardless of their parent.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Ex<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Ex is relative to the x-height of the current font and it&#8217;s very rarely used. The x-height measurement is not consistent; sometimes it comes from the font itself and sometimes the browser calculates itself.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Like em and rem, it depends on font but the major difference is that ex will change when you change the <code>font-family<\/code> too, which is not the case with the other two.<\/p>\n\n\n<p>[css]<br \/>\n.box{<br \/>\nwidth:150ex;<br \/>\nheight:150ex;<br \/>\n}<br \/>\n[\/css]<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Ch<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Ch is similar to ex but it doesn&#8217;t depend on the x-height; rather on the width of the zero (0) character. It also changes with <code>font-family<\/code>.<\/p>\n\n\n<p>[css]<br \/>\n.box{<br \/>\nwidth:150ch;<br \/>\nheight:150ch;<br \/>\n}<br \/>\n[\/css]<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Viewport-relative CSS units<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">There are a few units that depend on the viewport height and width size, such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>vh (viewport height)<\/li>\n\n\n\n<li>vw (viewport width)<\/li>\n\n\n\n<li>vmin (viewport minimum)<\/li>\n\n\n\n<li>vmax (viewport maximum)<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Vh<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Vh (viewport height) is measured as <code>1vh<\/code> equal to 1% of the viewport\u2019s height. This unit is very useful for creating full height elements. Vh reacts similarly to percentage, but doesn&#8217;t depend on the parent element height.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can use vh anywhere but the most common use case of vh is for making full height elements. In this example, the <code>full-height<\/code> class will create a blue container which will be 100% height of the viewport.<\/p>\n\n\n<p>[css]<br \/>\n.full-height{<br \/>\nheight:100vh;<br \/>\nbackground:blue;<br \/>\n}<br \/>\n[\/css]<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Vw<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Vw (viewport width) is similar to vh but it considers the width, rather than height of the viewport. &nbsp;1vw is equal to 1% of the viewport width. These units can be really helpful if you want to create <a href=\"https:\/\/css-tricks.com\/viewport-sized-typography\/\" target=\"_blank\" rel=\"noopener noreferrer\">a responsive viewport based on typography<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, <code>font-siz<\/code> of <code>h1<\/code> is 6% of the viewport width, so if viewport width is 1000px, the font size will be 60px, and if the viewport is 500px, the font size will be 30px.<\/p>\n\n\n<p>[css]<br \/>\nh1{<br \/>\nfont-size:6vw;<br \/>\n}<br \/>\n[\/css]<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Vmin<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Vmin is calculated on the basis of the minimum value of the viewport&#8217;s width or height, whichever is smaller. Say you have a viewport size of 1000px tall by 800px wide. <code>1vmin<\/code> will be equal to 8px.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Vmax<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Vmax is calculated exactly the opposite of <code>vmin<\/code>, where the maximum value is considered of the viewport.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Like the previous &nbsp;viewport example with 1000px tall by 800px wide, <code>1vmax<\/code> will be equal to 10px.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Now let&#8217;s explore how you can use <code>vmin<\/code> and <code>vmax<\/code> effectively. Using our previous example, let\u2019s say we want to have a fluid padding and margin based on the viewport size now, rather than a fixed value.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this code snippet, I\u2019ve set the padding to <code>3vmax<\/code> and margin to <code>1.5vmin<\/code>.<\/p>\n\n\n<p>[css]<br \/>\n.post-item{<br \/>\nbackground pink;<br \/>\npadding:3vmax;<br \/>\nmargin:1.5vmin;<br \/>\n}<br \/>\n[\/css]<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/getflywheel-images.s3.us-east-2.amazonaws.com\/uploads\/2018\/05\/image3-662x253.jpg\" alt=\"6 CSS units, the three on the left side are longer in length and shorter in height, the three on the right are taller in height but shorter in length\" class=\"wp-image-27751\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The padding and margin will change according to the viewport size.<br><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Percentage(%) unit<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Percentage(%) unit doesn&#8217;t belong to any particular category mentioned above, but can be categorized as a relative unit. It is relative to its parent element.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Percentage is primarily associated with height and width of an element, but can be used anywhere where CSS length units are allowed.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Percentage is one of the most useful CSS units for creating a responsive or fluid layout. Popular frameworks like Bootstrap, foundation, and Bulma use percentage for their base layout.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here the <code>full-width<\/code> class will be of 100% width of its parent element.<\/p>\n\n\n<p>[css]<br \/>\n.full-width{<br \/>\nwidth: 100%;<br \/>\n}<br \/>\n[\/css]<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Keep best practices in mind with WP Engine<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This article has discussed nearly every CSS unit that is ready for application. Your goals will undoubtedly dictate which CSS units are the most appropriate. As a front-end developer, familiarizing yourself with the best practices for CSS units is pivotal, since you never know when they might come in handy in your upcoming project.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When you&#8217;re ready to focus more on site design elements like your CSS and less on the ins and outs of <a href=\"https:\/\/wpengine.com\/wordpress-hosting\/\" target=\"_blank\" rel=\"noreferrer noopener\">hosting for WordPress sites<\/a>, talk with an expert at WP Engine to discuss your options!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CSS units are one of the most fundamental aspects to consider while creating a site layout. These units will define how your design will interact on various devices. But when it comes to CSS units, there are many options to choose from and all options are not equal. CSS units are not limited to fonts<span class=\"tile__ellipses\">&hellip;<\/span><span class=\"tile__ellipses--animated\"><\/span><\/p>\n","protected":false},"author":1,"featured_media":140002,"template":"","resource-topic":[1396,901],"resource-role":[896],"resource-type":[916],"class_list":["post-139767","resource","type-resource","status-publish","has-post-thumbnail","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>CSS Units Best Practices for Effective Web Design<\/title>\n<meta name=\"description\" content=\"Enhance your web design with best practices for CSS units. Learn how to effectively implement Pixels, Rem, Em, Vh, Vw, and more for superior layouts.\" \/>\n<meta name=\"robots\" content=\"noindex, follow\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CSS Units Best Practices for Effective Web Design\" \/>\n<meta property=\"og:description\" content=\"Enhance your web design with best practices for CSS units. Learn how to effectively implement Pixels, Rem, Em, Vh, Vw, and more for superior layouts.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/case-studies\/resources\/choose-css-unit-create-better-site-layouts-how-to\/\" \/>\n<meta property=\"og:site_name\" content=\"WP Engine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/wpengine\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-29T17:21:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/06\/css-header.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1100\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"CSS Units Best Practices for Effective Web Design\" \/>\n<meta name=\"twitter:description\" content=\"Enhance your web design with best practices for CSS units. Learn how to effectively implement Pixels, Rem, Em, Vh, Vw, and more for superior layouts.\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/06\/css-header.png\" \/>\n<meta name=\"twitter:site\" content=\"@wpengine\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/choose-css-unit-create-better-site-layouts-how-to\/\",\"url\":\"https:\/\/wpengine.com\/case-studies\/resources\/choose-css-unit-create-better-site-layouts-how-to\/\",\"name\":\"CSS Units Best Practices for Effective Web Design\",\"isPartOf\":{\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\"},\"datePublished\":\"2018-06-04T17:00:31+00:00\",\"dateModified\":\"2024-09-29T17:21:44+00:00\",\"description\":\"Enhance your web design with best practices for CSS units. Learn how to effectively implement Pixels, Rem, Em, Vh, Vw, and more for superior layouts.\",\"breadcrumb\":{\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/choose-css-unit-create-better-site-layouts-how-to\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wpengine.com\/case-studies\/resources\/choose-css-unit-create-better-site-layouts-how-to\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/choose-css-unit-create-better-site-layouts-how-to\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wpengine.com\/case-studies\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Resources\",\"item\":\"https:\/\/wpengine.com\/case-studies\/resources\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Choose the Best CSS Unit to Create Better Site Layouts\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\",\"url\":\"https:\/\/wpengine.com\/case-studies\/\",\"name\":\"WP Engine\",\"description\":\"Managed Hosting for WordPress\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/f5301455463371a10d1fc290e9ad0085\",\"name\":\"WP Engine\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g\",\"caption\":\"WP Engine\"},\"sameAs\":[\"https:\/\/wpengine.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CSS Units Best Practices for Effective Web Design","description":"Enhance your web design with best practices for CSS units. Learn how to effectively implement Pixels, Rem, Em, Vh, Vw, and more for superior layouts.","robots":{"index":"noindex","follow":"follow"},"og_locale":"en_US","og_type":"article","og_title":"CSS Units Best Practices for Effective Web Design","og_description":"Enhance your web design with best practices for CSS units. Learn how to effectively implement Pixels, Rem, Em, Vh, Vw, and more for superior layouts.","og_url":"https:\/\/wpengine.com\/case-studies\/resources\/choose-css-unit-create-better-site-layouts-how-to\/","og_site_name":"WP Engine","article_publisher":"https:\/\/www.facebook.com\/wpengine","article_modified_time":"2024-09-29T17:21:44+00:00","og_image":[{"width":1100,"height":500,"url":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/06\/css-header.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_title":"CSS Units Best Practices for Effective Web Design","twitter_description":"Enhance your web design with best practices for CSS units. Learn how to effectively implement Pixels, Rem, Em, Vh, Vw, and more for superior layouts.","twitter_image":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/06\/css-header.png","twitter_site":"@wpengine","twitter_misc":{"Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wpengine.com\/case-studies\/resources\/choose-css-unit-create-better-site-layouts-how-to\/","url":"https:\/\/wpengine.com\/case-studies\/resources\/choose-css-unit-create-better-site-layouts-how-to\/","name":"CSS Units Best Practices for Effective Web Design","isPartOf":{"@id":"https:\/\/wpengine.com\/case-studies\/#website"},"datePublished":"2018-06-04T17:00:31+00:00","dateModified":"2024-09-29T17:21:44+00:00","description":"Enhance your web design with best practices for CSS units. Learn how to effectively implement Pixels, Rem, Em, Vh, Vw, and more for superior layouts.","breadcrumb":{"@id":"https:\/\/wpengine.com\/case-studies\/resources\/choose-css-unit-create-better-site-layouts-how-to\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/case-studies\/resources\/choose-css-unit-create-better-site-layouts-how-to\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/case-studies\/resources\/choose-css-unit-create-better-site-layouts-how-to\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/case-studies\/"},{"@type":"ListItem","position":2,"name":"Resources","item":"https:\/\/wpengine.com\/case-studies\/resources\/"},{"@type":"ListItem","position":3,"name":"How to Choose the Best CSS Unit to Create Better Site Layouts"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/case-studies\/#website","url":"https:\/\/wpengine.com\/case-studies\/","name":"WP Engine","description":"Managed Hosting for WordPress","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/f5301455463371a10d1fc290e9ad0085","name":"WP Engine","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d8770fe9625ca7c4601f13d9d0ab86565a6dac8cd6a77bfe2ada6d83c6837870?s=96&d=mm&r=g","caption":"WP Engine"},"sameAs":["https:\/\/wpengine.com"]}]}},"acf":[],"grid_image_url":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2018\/06\/css-grid.png","media-type":{"term_id":916,"name":"Article","slug":"article"},"role":"<strong>Roles:<\/strong> Developer","topic":"<strong>Topics:<\/strong> Design, WordPress","_links":{"self":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource\/139767","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource"}],"about":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/types\/resource"}],"author":[{"embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/users\/1"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/media\/140002"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/media?parent=139767"}],"wp:term":[{"taxonomy":"resource-topic","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-topic?post=139767"},{"taxonomy":"resource-role","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-role?post=139767"},{"taxonomy":"resource-type","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-type?post=139767"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}