{"id":20395,"date":"2015-06-02T11:00:15","date_gmt":"2015-06-02T05:30:15","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=20395"},"modified":"2016-12-19T15:02:50","modified_gmt":"2016-12-19T09:32:50","slug":"working-with-css-calc","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/","title":{"rendered":"Working with CSS- calc()"},"content":{"rendered":"<h1 style=\"text-align: center;\">Working with CSS- calc()<\/h1>\n<p>These days CSS has the ability to do some cool stuff like animations, gradients, transforms,<br \/>\ncreating sophisticated interfaces with flexible box layouts etc.<\/p>\n<p>In this blog we will learn how to use the <strong>calc<\/strong><em><strong>()<\/strong><\/em> CSS function, which is very useful for calculation in CSS.<\/p>\n<h3><strong>How to use it:<\/strong><\/h3>\n<p>calc() allow us to use the mathematical formula within CSS with height, width and font-sizes etc. To measure we can use four maths operators add(+), subtract(-), multiply(*) and divide(\/).<\/p>\n<h3><strong>Syntax:<\/strong><\/h3>\n<p>[css]<\/p>\n<p>\twidth:calc(100% \/ 4);\t<\/p>\n<p>[\/css]<\/p>\n<h3><strong>Uses of calc() function:<\/strong><\/h3>\n<div>\n<div style=\"float: left; width: 40%; margin-right: 2%;\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-20428\" style=\"margin: 0;\" src=\"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/sample.jpg\" alt=\"sample\" width=\"290\" height=\"484\" \/><\/div>\n<div style=\"float: left; width: 58%;\">\n<p>Suppose there is content <span style=\"color: #99cc00;\">&lt;div&gt;<\/span>\u00a0which is supposed to adjust height according to the height of the browser. Here is the tricky part of the problem\u00a0wherein the\u00a0content should be just below the header. We usually achieve it via plain old vanilla JavaScript or jQuery. But this can easily be achieved by using CSS calc() function.<\/p>\n<p>[css]<\/p>\n<p>.content{<br \/>\n\theight:90%; \/*fallback*\/<br \/>\n\theight:calc(100% &#8211; 40px);<br \/>\n}<\/p>\n<p>[\/css]<\/p>\n<\/div>\n<div style=\"clear: both;\"><\/div>\n<\/div>\n<h3><strong>Browser support:<\/strong><\/h3>\n<p>It is supported by almost all modern browsers. On desktop version it supports IE 9+, Safari 6+.<br \/>\nFor reference you can use the following link:<br \/>\n<a href=\"http:\/\/caniuse.com\/#search=calc%28%29\">http:\/\/caniuse.com\/#search=calc%28%29<\/a><\/p>\n<p>For browsers that don&#8217;t support <strong>calc()<\/strong>, \u00a0use the following polyfill:<br \/>\nhttps:\/\/github.com\/closingtag\/calc-polyfill<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Working with CSS- calc() These days CSS has the ability to do some cool stuff like animations, gradients, transforms, creating sophisticated interfaces with flexible box layouts etc. In this blog we will learn how to use the calc() CSS function, which is very useful for calculation in CSS. How to use it: calc() allow us [&hellip;]<\/p>\n","protected":false},"author":50,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":3,"footnotes":""},"categories":[1],"tags":[355,378],"class_list":["post-20395","post","type-post","status-publish","format-standard","hentry","category-technology","tag-css3","tag-html5"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"Working with CSS- calc() These days CSS has the ability to do some cool stuff like animations, gradients, transforms, creating sophisticated interfaces with flexible box layouts etc. In this blog we will learn how to use the calc() CSS function, which is very useful for calculation in CSS. How to use it: calc() allow us\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Rajan Shergill\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"TO THE NEW BLOG\" \/>\n\t\t<meta property=\"og:type\" content=\"blog\" \/>\n\t\t<meta property=\"og:title\" content=\"Working with CSS- calc() | TO THE NEW Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"Working with CSS- calc() These days CSS has the ability to do some cool stuff like animations, gradients, transforms, creating sophisticated interfaces with flexible box layouts etc. In this blog we will learn how to use the calc() CSS function, which is very useful for calculation in CSS. How to use it: calc() allow us\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@tothenew\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Working with CSS- calc() | TO THE NEW Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Working with CSS- calc() These days CSS has the ability to do some cool stuff like animations, gradients, transforms, creating sophisticated interfaces with flexible box layouts etc. In this blog we will learn how to use the calc() CSS function, which is very useful for calculation in CSS. How to use it: calc() allow us\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/working-with-css-calc\\\/#article\",\"name\":\"Working with CSS- calc() | TO THE NEW Blog\",\"headline\":\"Working with CSS- calc()\",\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/rajan\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"\\\/blog\\\/wp-ttn-blog\\\/uploads\\\/2015\\\/06\\\/sample.jpg\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/working-with-css-calc\\\/#articleImage\"},\"datePublished\":\"2015-06-02T11:00:15+05:30\",\"dateModified\":\"2016-12-19T15:02:50+05:30\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/working-with-css-calc\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/working-with-css-calc\\\/#webpage\"},\"articleSection\":\"Technology, CSS3, HTML5\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/working-with-css-calc\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/working-with-css-calc\\\/#listItem\",\"name\":\"Working with CSS- calc()\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/working-with-css-calc\\\/#listItem\",\"position\":3,\"name\":\"Working with CSS- calc()\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\",\"name\":\"TO THE NEW Blog\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/rajan\\\/#author\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/rajan\\\/\",\"name\":\"Rajan Shergill\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/working-with-css-calc\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/eb5d445c6d373510aede382494d12659d23728d95f26b7cef5d075dc66529ded?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Rajan Shergill\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/working-with-css-calc\\\/#webpage\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/working-with-css-calc\\\/\",\"name\":\"Working with CSS- calc() | TO THE NEW Blog\",\"description\":\"Working with CSS- calc() These days CSS has the ability to do some cool stuff like animations, gradients, transforms, creating sophisticated interfaces with flexible box layouts etc. In this blog we will learn how to use the calc() CSS function, which is very useful for calculation in CSS. How to use it: calc() allow us\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/working-with-css-calc\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/rajan\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/author\\\/rajan\\\/#author\"},\"datePublished\":\"2015-06-02T11:00:15+05:30\",\"dateModified\":\"2016-12-19T15:02:50+05:30\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/\",\"name\":\"TO THE NEW Blog\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.tothenew.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Working with CSS- calc() | TO THE NEW Blog","description":"Working with CSS- calc() These days CSS has the ability to do some cool stuff like animations, gradients, transforms, creating sophisticated interfaces with flexible box layouts etc. In this blog we will learn how to use the calc() CSS function, which is very useful for calculation in CSS. How to use it: calc() allow us","canonical_url":"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/#article","name":"Working with CSS- calc() | TO THE NEW Blog","headline":"Working with CSS- calc()","author":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/rajan\/#author"},"publisher":{"@id":"https:\/\/www.tothenew.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"\/blog\/wp-ttn-blog\/uploads\/2015\/06\/sample.jpg","@id":"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/#articleImage"},"datePublished":"2015-06-02T11:00:15+05:30","dateModified":"2016-12-19T15:02:50+05:30","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/#webpage"},"isPartOf":{"@id":"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/#webpage"},"articleSection":"Technology, CSS3, HTML5"},{"@type":"BreadcrumbList","@id":"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.tothenew.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/www.tothenew.com\/blog\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/#listItem","name":"Working with CSS- calc()"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/#listItem","position":3,"name":"Working with CSS- calc()","previousItem":{"@type":"ListItem","@id":"https:\/\/www.tothenew.com\/blog\/category\/technology\/#listItem","name":"Technology"}}]},{"@type":"Organization","@id":"https:\/\/www.tothenew.com\/blog\/#organization","name":"TO THE NEW Blog","url":"https:\/\/www.tothenew.com\/blog\/"},{"@type":"Person","@id":"https:\/\/www.tothenew.com\/blog\/author\/rajan\/#author","url":"https:\/\/www.tothenew.com\/blog\/author\/rajan\/","name":"Rajan Shergill","image":{"@type":"ImageObject","@id":"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/eb5d445c6d373510aede382494d12659d23728d95f26b7cef5d075dc66529ded?s=96&d=mm&r=g","width":96,"height":96,"caption":"Rajan Shergill"}},{"@type":"WebPage","@id":"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/#webpage","url":"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/","name":"Working with CSS- calc() | TO THE NEW Blog","description":"Working with CSS- calc() These days CSS has the ability to do some cool stuff like animations, gradients, transforms, creating sophisticated interfaces with flexible box layouts etc. In this blog we will learn how to use the calc() CSS function, which is very useful for calculation in CSS. How to use it: calc() allow us","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.tothenew.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/#breadcrumblist"},"author":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/rajan\/#author"},"creator":{"@id":"https:\/\/www.tothenew.com\/blog\/author\/rajan\/#author"},"datePublished":"2015-06-02T11:00:15+05:30","dateModified":"2016-12-19T15:02:50+05:30"},{"@type":"WebSite","@id":"https:\/\/www.tothenew.com\/blog\/#website","url":"https:\/\/www.tothenew.com\/blog\/","name":"TO THE NEW Blog","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.tothenew.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"TO THE NEW BLOG","og:type":"blog","og:title":"Working with CSS- calc() | TO THE NEW Blog","og:description":"Working with CSS- calc() These days CSS has the ability to do some cool stuff like animations, gradients, transforms, creating sophisticated interfaces with flexible box layouts etc. In this blog we will learn how to use the calc() CSS function, which is very useful for calculation in CSS. How to use it: calc() allow us","og:url":"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/","og:image":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","og:image:secure_url":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png","twitter:card":"summary","twitter:site":"@tothenew","twitter:title":"Working with CSS- calc() | TO THE NEW Blog","twitter:description":"Working with CSS- calc() These days CSS has the ability to do some cool stuff like animations, gradients, transforms, creating sophisticated interfaces with flexible box layouts etc. In this blog we will learn how to use the calc() CSS function, which is very useful for calculation in CSS. How to use it: calc() allow us","twitter:image":"https:\/\/www.tothenew.com\/blog\/wp-content\/themes\/ttn\/images\/social-logo.png"},"aioseo_meta_data":{"post_id":"20395","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":"","og_description":"","og_object_type":"blog","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":"","og_article_tags":"","twitter_use_og":false,"twitter_card":"summary","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2021-04-29 17:30:02","updated":"2024-02-29 08:49:41","focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.tothenew.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.tothenew.com\/blog\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tWorking with CSS- calc()\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.tothenew.com\/blog"},{"label":"Technology","link":"https:\/\/www.tothenew.com\/blog\/category\/technology\/"},{"label":"Working with CSS- calc()","link":"https:\/\/www.tothenew.com\/blog\/working-with-css-calc\/"}],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/20395","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/users\/50"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=20395"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/20395\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=20395"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=20395"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=20395"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}