Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the alpha-core domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/joinweb1/public_html/websites/codex/wp-includes/functions.php on line 6114
Warning: Cannot modify header information - headers already sent by (output started at /home/joinweb1/public_html/websites/codex/wp-includes/functions.php:6114) in /home/joinweb1/public_html/websites/codex/wp-includes/rest-api/class-wp-rest-server.php on line 1893
Warning: Cannot modify header information - headers already sent by (output started at /home/joinweb1/public_html/websites/codex/wp-includes/functions.php:6114) in /home/joinweb1/public_html/websites/codex/wp-includes/rest-api/class-wp-rest-server.php on line 1893
Warning: Cannot modify header information - headers already sent by (output started at /home/joinweb1/public_html/websites/codex/wp-includes/functions.php:6114) in /home/joinweb1/public_html/websites/codex/wp-includes/rest-api/class-wp-rest-server.php on line 1893
Warning: Cannot modify header information - headers already sent by (output started at /home/joinweb1/public_html/websites/codex/wp-includes/functions.php:6114) in /home/joinweb1/public_html/websites/codex/wp-includes/rest-api/class-wp-rest-server.php on line 1893
Warning: Cannot modify header information - headers already sent by (output started at /home/joinweb1/public_html/websites/codex/wp-includes/functions.php:6114) in /home/joinweb1/public_html/websites/codex/wp-includes/rest-api/class-wp-rest-server.php on line 1893
Warning: Cannot modify header information - headers already sent by (output started at /home/joinweb1/public_html/websites/codex/wp-includes/functions.php:6114) in /home/joinweb1/public_html/websites/codex/wp-includes/rest-api/class-wp-rest-server.php on line 1893
Warning: Cannot modify header information - headers already sent by (output started at /home/joinweb1/public_html/websites/codex/wp-includes/functions.php:6114) in /home/joinweb1/public_html/websites/codex/wp-includes/rest-api/class-wp-rest-server.php on line 1893
Warning: Cannot modify header information - headers already sent by (output started at /home/joinweb1/public_html/websites/codex/wp-includes/functions.php:6114) in /home/joinweb1/public_html/websites/codex/wp-includes/rest-api/class-wp-rest-server.php on line 1893
{"id":181,"date":"2014-12-04T09:43:38","date_gmt":"2014-12-04T09:43:38","guid":{"rendered":"http:\/\/www.sircodex.com\/?p=181"},"modified":"2014-12-04T09:43:38","modified_gmt":"2014-12-04T09:43:38","slug":"css3-gems-the-calc-function","status":"publish","type":"post","link":"https:\/\/www.sircodex.com\/css3-gems-the-calc-function\/","title":{"rendered":"CSS3 Gems: The calc() Function"},"content":{"rendered":"There are many hidden gems in the modular CSS3 specifications. In this post we\u2019ll look at calc(); an incredibly useful property which may change the way you approach layout design.<\/p>\n
The CSS3 calc() function is primarily used to calculate lengths, numbers, angles, transition\/animation times or sound frequencies. However, it allows you to mix measurement types \u2014 a powerful concept in CSS.<\/p>\n
Consider a website layout containing two floated elements. You want both elements to be an equal width separated by a 60px horizontal margin. Sounds easy? It\u2019s not a problem in fixed-width design; if the page width is 960px, both elements will be 450px.<\/p>\n
But what about fluid or responsive layouts? It\u2019s not possible to determine the page width so most developers would set each element to, say, 45%. The 10% margin will only be 60px if the page happens to be 600px; a wider or narrower browser window will enlarge or contract the margin accordingly.<\/p>\n
Fortunately, the new calc() function allows us to calculate widths. In this case, we want both elements to be 50% minus 30px, e.g.<\/p>\n
The calc() function is a W3C recommendation so guess which browser offers native support?<\/p>\n
You\u2019re wrong. At the time of writing, it\u2019s just Internet Explorer 9. Firefox also supports it with a prefix; -moz-calc(). It\u2019s not been implemented in webkit (Chrome and Safari) or Opera yet but, it\u2019s so useful, I suspect we won\u2019t need to wait long.<\/p>\n
Fortunately, you can use progressive enhancement in your stylesheets:<\/p>\n
If you like calc(), you\u2019ll love the min() and max() functions. They accept two or more comma-separated values and return the minimum or maximum accordingly, e.g.<\/p>\n
There are many hidden gems in the modular CSS3 specifications. In this post we\u2019ll look at calc(); an incredibly useful property which may change the way you approach layout design. The CSS3 calc() function is primarily used to calculate lengths, numbers, angles, transition\/animation times or sound frequencies. However, it allows you to mix measurement types […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[7],"tags":[],"class_list":["post-181","post","type-post","status-publish","format-standard","hentry","category-css3"],"aioseo_notices":[],"yoast_head":"\n
CSS3 Gems: The calc() Function - Sir Codex<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n