{"id":16186,"date":"2012-02-01T11:33:31","date_gmt":"2012-02-01T18:33:31","guid":{"rendered":"http:\/\/css-tricks.com\/?p=16186"},"modified":"2014-09-23T06:06:29","modified_gmt":"2014-09-23T13:06:29","slug":"better-box-sizing","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/better-box-sizing\/","title":{"rendered":"Better Box Sizing"},"content":{"rendered":"

Paul Irish suggests the universal selector (*) to apply border-box<\/code> box-sizing<\/a><\/code> to every element. I’ve been wanting to try this forever because this box model is, in my opinion, just better. Imagine: elements with percentage widths and pixel padding without worry.<\/p>\n","protected":false},"excerpt":{"rendered":"

Paul Irish suggests the universal selector (*) to apply border-box box-sizing to every element. I’ve been wanting to try this forever because this box model is, in my opinion, just better. Imagine: elements with percentage widths and pixel padding without worry.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[17],"tags":[478],"jetpack_publicize_connections":[],"acf":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":175473,"url":"https:\/\/css-tricks.com\/inheriting-box-sizing-probably-slightly-better-best-practice\/","url_meta":{"origin":16186,"position":0},"title":"Inheriting box-sizing Probably Slightly Better Best-Practice","date":"July 15, 2014","format":false,"excerpt":"I'm a big fan of resetting box-sizing to border-box, so much that we have a special day of the year around here. But there is a little adjustment to setting it that seems like a pretty good idea. Here's the adjusted version: html { box-sizing: border-box; } *, *:before, *:after\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":161608,"url":"https:\/\/css-tricks.com\/international-box-sizing-awareness-day\/","url_meta":{"origin":16186,"position":1},"title":"International box-sizing Awareness Day","date":"February 1, 2014","format":false,"excerpt":"It's February 1st today, which I've decided to declare International box-sizing Awareness Day. In honor of, you guessed it, the most humble and undersung, yet awesome and useful CSS property: box-sizing. The date corresponds to Paul Irish's post where he introduced the concept of using it on every single element\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7323,"url":"https:\/\/css-tricks.com\/box-sizing\/","url_meta":{"origin":16186,"position":2},"title":"Box Sizing","date":"September 10, 2010","format":false,"excerpt":"The box-sizing property can make building CSS layouts easier and a lot more intuitive. It's such a boon for developers that here at CSS-Tricks we observe International Box-Sizing Awareness Day in February. But, how is it so helpful and beloved that it deserves its own internet holiday? Time for a\u2026","rel":"","context":"In "Advanced"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2010\/09\/widthbox.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":16302,"url":"https:\/\/css-tricks.com\/things-it-might-be-funuseful-to-try-the-universal-selector-on\/","url_meta":{"origin":16186,"position":3},"title":"Things It Might Be Fun\/Useful to Try the Universal (*) Selector On","date":"February 15, 2012","format":false,"excerpt":"What CSS properties might it make sense to apply to every single element on the page? We'll take a look at some that may (or may not) be a good idea.","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":21673,"url":"https:\/\/css-tricks.com\/replace-the-image-in-an-img-with-css\/","url_meta":{"origin":16186,"position":4},"title":"Replace the Image in an <img> with CSS","date":"May 20, 2013","format":false,"excerpt":"The following is a guest post by\u00a0Marcel Shields. Marcel was in a difficult place where he needed to change the image on a page but didn\u2019t have access to the HTML. Rare, but I\u2019m sure we\u2019ve all be in weird situations like this. He explains how he managed to replace\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":21838,"url":"https:\/\/css-tricks.com\/a-couple-of-use-cases-for-calc\/","url_meta":{"origin":16186,"position":5},"title":"A Couple of Use Cases for Calc()","date":"June 5, 2013","format":false,"excerpt":"calc() is a native CSS way to do simple math right in CSS as a replacement for any length value (or pretty much any number value). It has four simple math operators: add (+), subtract (-), multiply (*), and divide (\/). Being able to do math in code is nice\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/16186"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=16186"}],"version-history":[{"count":5,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/16186\/revisions"}],"predecessor-version":[{"id":184341,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/16186\/revisions\/184341"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=16186"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/categories?post=16186"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=16186"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}