{"id":2022,"date":"2010-11-13T12:50:00","date_gmt":"2010-11-13T07:20:00","guid":{"rendered":"http:\/\/www.tothenew.com\/blog\/?p=2022"},"modified":"2010-11-13T12:50:00","modified_gmt":"2010-11-13T07:20:00","slug":"clearfix-css-hack","status":"publish","type":"post","link":"https:\/\/www.tothenew.com\/blog\/clearfix-css-hack\/","title":{"rendered":"clearfix css hack"},"content":{"rendered":"<p>The clearfix hack, or \u201ceasy-clearing\u201d hack, is a useful method of clearing  float(left, right) effort. The clearfix hack works great, but the browsers that it targets are either obsolete or well on their way. Specifically, Internet Explorer 5 for Mac is now history, so there is no reason to bother with it when using the clearfix method of clearing floats.<\/p>\n<p>When the container not wrapping floated divs within it.clearfix hack (which includes the guillotine bug for IE etc). It fixes the problem.<\/p>\n<p><strong>Definition and Usage<\/strong><br \/>\nThis code define in css <\/p>\n<div class=\"wp_syntax\">\n<div class=\"code\">\n<pre class=\"groovy\">\r\n<p>\/* new clearfix *\/\r\n.clearfix:after {\r\n\tvisibility: hidden;\r\n\tdisplay: block;\r\n\tfont-size: 0;\r\n\tcontent: \" \";\r\n\tclear: both;\r\n\theight: 0;\r\n\t}\r\n* html .clearfix             { zoom: 1; } \/* IE6 *\/\r\n*:first-child+html .clearfix { zoom: 1; } \/* IE7 *\/<\/p>\r\n<\/pre>\n<\/div>\n<\/div>\n<p><strong>Tips and Notes<\/strong><br \/>\nAdd class in html code <\/p>\n<div class=\"wp_syntax\">\n<div class=\"code\">\n<pre class=\"groovy\"><p>Class=\u201dclearfix\u201d<\/p><\/pre>\n<\/div>\n<\/div>\n<p>I happens most often (or is most noticeable) when you\u2019ve got a design that wants to go flush to the bottom of the browser. However, for some damn reason, it just won\u2019t go flush \u2014 it is that pesky five or so pixels that just won\u2019t budge. Playing with the padding and margins don\u2019t help \u2014 what could it be? Check the containing element and see if you\u2019ve applied the clearfix css hack to it \u2026 because if you did, our money is that is your problem.<br \/>\nThere are many variations of clearfix floating around the web.The clearfix method applies clearing rules to standards-compliant browsers using the :after pseudo-class. For IE6 and IE7, This clearfix method triggers has Layout with some proprietary CSS. Thus Clearfix method effectively clears floats in all currently used browsers without using any hacks.<br \/>\n<br \/><strong>Support browser<\/strong><\/p>\n<table cellspacing=\"1\" cellpadding=\"4\" bgcolor=\"#cccccc\" width=\"100%\" style=\"border-spacing: 1px; border-collapse: inherit; font-size: 12px; font-family: Arial,Helvetica,sans-serif,'Arial Rounded MT Bold';\">\n<tbody>\n<tr>\n<td bgcolor=\"#e6e6e6\" width=\"100\"><strong>IE<\/strong><\/td>\n<td bgcolor=\"#e6e6e6\" width=\"100\"><strong> Firefox <\/strong><\/td>\n<td bgcolor=\"#e6e6e6\" width=\"100\"><strong>Safari <\/strong><\/td>\n<td bgcolor=\"#e6e6e6\" width=\"100\"><strong>Chrome<\/strong><\/td>\n<td bgcolor=\"#e6e6e6\" width=\"100\"><strong> Opera<\/strong><\/td>\n<td bgcolor=\"#e6e6e6\" width=\"100\"><strong> iPhone<\/strong><\/td>\n<td bgcolor=\"#e6e6e6\"><strong> Android<\/strong><\/td>\n<\/tr>\n<tr>\n<td bgcolor=\"#ffffff\">6.0+<\/td>\n<td bgcolor=\"#ffffff\">3.5+<\/td>\n<td bgcolor=\"#ffffff\">3.0+<\/td>\n<td bgcolor=\"#ffffff\">3.0+<\/td>\n<td bgcolor=\"#ffffff\">10.5+<\/td>\n<td bgcolor=\"#ffffff\">1.0+<\/td>\n<td bgcolor=\"#ffffff\">2.0+<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>The clearfix hack, or \u201ceasy-clearing\u201d hack, is a useful method of clearing float(left, right) effort. The clearfix hack works great, but the browsers that it targets are either obsolete or well on their way. Specifically, Internet Explorer 5 for Mac is now history, so there is no reason to bother with it when using the [&hellip;]<\/p>\n","protected":false},"author":23,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":3},"categories":[1],"tags":[451,245,4842],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/2022"}],"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\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/comments?post=2022"}],"version-history":[{"count":0,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/posts\/2022\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/media?parent=2022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/categories?post=2022"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tothenew.com\/blog\/wp-json\/wp\/v2\/tags?post=2022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}