{"id":31,"date":"2012-05-05T00:04:34","date_gmt":"2012-05-05T00:04:34","guid":{"rendered":"https:\/\/learnwebcode.com\/?p=31"},"modified":"2016-03-29T01:37:30","modified_gmt":"2016-03-29T01:37:30","slug":"clearing-css-floats-clearfix","status":"publish","type":"post","link":"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/","title":{"rendered":"Clearing CSS Floats \u2013 Clearfix"},"content":{"rendered":"<p>Every web designer \/ developer has a preferred method for clearing their floats. I\u2019m partial to simply tacking on a class of \u201cclearfix\u201d to a parent element which has floated children. Below is the CSS code for this \u201cclearfix\u201d method. If you are unable to copy and paste the code below, here is a link to a <a href=\"https:\/\/learnwebcode.com\/tutorial-files\/css-column-layout-tutorial\/clearfix.txt\">plain text file with the same code<\/a>.<\/p>\n<pre class=\"brush: css; title: ; notranslate\" title=\"\">\r\n.clearfix:after {\r\n    content: &quot;.&quot;;\r\n    display: block;\r\n    height: 0;\r\n    clear: both;\r\n    visibility: hidden;\r\n}\r\n\r\n.clearfix {display: inline-block;}\r\n\r\n\/* Hides from IE-mac \\*\/\r\n* html .clearfix {height: 1%;}\r\n.clearfix {display: block;}\r\n\/* End hide from IE-mac *\/\r\n<\/pre>\n<p>If you prefer to watch video lessons instead of reading written lessons check out <a href=\"\/web-design-for-beginners-real-world-coding-html-css\/\">my 8 hour video course<\/a> and learn pro-level HTML, CSS, and responsive design.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Every web designer \/ developer has a preferred method for clearing their floats. I\u2019m partial to simply tacking on a class of \u201cclearfix\u201d to a parent element which has floated children. Below is the CSS code for this \u201cclearfix\u201d method. If you are unable to copy and paste the code below, here is a link [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-31","post","type-post","status-publish","format-standard","hentry","category-css-tips"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Clearing CSS Floats \u2013 Clearfix - LearnWebCode<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Clearing CSS Floats \u2013 Clearfix - LearnWebCode\" \/>\n<meta property=\"og:description\" content=\"Every web designer \/ developer has a preferred method for clearing their floats. I\u2019m partial to simply tacking on a class of \u201cclearfix\u201d to a parent element which has floated children. Below is the CSS code for this \u201cclearfix\u201d method. If you are unable to copy and paste the code below, here is a link [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/\" \/>\n<meta property=\"og:site_name\" content=\"LearnWebCode\" \/>\n<meta property=\"article:published_time\" content=\"2012-05-05T00:04:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2016-03-29T01:37:30+00:00\" \/>\n<meta name=\"author\" content=\"Brad\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Brad\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/\"},\"author\":{\"name\":\"Brad\",\"@id\":\"https:\/\/learnwebcode.com\/#\/schema\/person\/db825ebc5a08e39b01de31771e4c7fe6\"},\"headline\":\"Clearing CSS Floats \u2013 Clearfix\",\"datePublished\":\"2012-05-05T00:04:34+00:00\",\"dateModified\":\"2016-03-29T01:37:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/\"},\"wordCount\":124,\"commentCount\":15,\"publisher\":{\"@id\":\"https:\/\/learnwebcode.com\/#\/schema\/person\/db825ebc5a08e39b01de31771e4c7fe6\"},\"articleSection\":[\"CSS Tips\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/\",\"url\":\"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/\",\"name\":\"Clearing CSS Floats \u2013 Clearfix - LearnWebCode\",\"isPartOf\":{\"@id\":\"https:\/\/learnwebcode.com\/#website\"},\"datePublished\":\"2012-05-05T00:04:34+00:00\",\"dateModified\":\"2016-03-29T01:37:30+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/learnwebcode.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Clearing CSS Floats \u2013 Clearfix\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/learnwebcode.com\/#website\",\"url\":\"https:\/\/learnwebcode.com\/\",\"name\":\"LearnWebCode\",\"description\":\"Become a Web Developer\",\"publisher\":{\"@id\":\"https:\/\/learnwebcode.com\/#\/schema\/person\/db825ebc5a08e39b01de31771e4c7fe6\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/learnwebcode.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/learnwebcode.com\/#\/schema\/person\/db825ebc5a08e39b01de31771e4c7fe6\",\"name\":\"Brad\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/learnwebcode.com\/wp-content\/uploads\/0UWl0Tet_400x400.jpg\",\"url\":\"https:\/\/learnwebcode.com\/wp-content\/uploads\/0UWl0Tet_400x400.jpg\",\"contentUrl\":\"https:\/\/learnwebcode.com\/wp-content\/uploads\/0UWl0Tet_400x400.jpg\",\"width\":400,\"height\":400,\"caption\":\"Brad\"},\"logo\":{\"@id\":\"https:\/\/learnwebcode.com\/wp-content\/uploads\/0UWl0Tet_400x400.jpg\"},\"url\":\"https:\/\/learnwebcode.com\/author\/lwcadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Clearing CSS Floats \u2013 Clearfix - LearnWebCode","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/","og_locale":"en_US","og_type":"article","og_title":"Clearing CSS Floats \u2013 Clearfix - LearnWebCode","og_description":"Every web designer \/ developer has a preferred method for clearing their floats. I\u2019m partial to simply tacking on a class of \u201cclearfix\u201d to a parent element which has floated children. Below is the CSS code for this \u201cclearfix\u201d method. If you are unable to copy and paste the code below, here is a link [&hellip;]","og_url":"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/","og_site_name":"LearnWebCode","article_published_time":"2012-05-05T00:04:34+00:00","article_modified_time":"2016-03-29T01:37:30+00:00","author":"Brad","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Brad","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/#article","isPartOf":{"@id":"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/"},"author":{"name":"Brad","@id":"https:\/\/learnwebcode.com\/#\/schema\/person\/db825ebc5a08e39b01de31771e4c7fe6"},"headline":"Clearing CSS Floats \u2013 Clearfix","datePublished":"2012-05-05T00:04:34+00:00","dateModified":"2016-03-29T01:37:30+00:00","mainEntityOfPage":{"@id":"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/"},"wordCount":124,"commentCount":15,"publisher":{"@id":"https:\/\/learnwebcode.com\/#\/schema\/person\/db825ebc5a08e39b01de31771e4c7fe6"},"articleSection":["CSS Tips"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/","url":"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/","name":"Clearing CSS Floats \u2013 Clearfix - LearnWebCode","isPartOf":{"@id":"https:\/\/learnwebcode.com\/#website"},"datePublished":"2012-05-05T00:04:34+00:00","dateModified":"2016-03-29T01:37:30+00:00","breadcrumb":{"@id":"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/learnwebcode.com\/clearing-css-floats-clearfix\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/learnwebcode.com\/"},{"@type":"ListItem","position":2,"name":"Clearing CSS Floats \u2013 Clearfix"}]},{"@type":"WebSite","@id":"https:\/\/learnwebcode.com\/#website","url":"https:\/\/learnwebcode.com\/","name":"LearnWebCode","description":"Become a Web Developer","publisher":{"@id":"https:\/\/learnwebcode.com\/#\/schema\/person\/db825ebc5a08e39b01de31771e4c7fe6"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/learnwebcode.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/learnwebcode.com\/#\/schema\/person\/db825ebc5a08e39b01de31771e4c7fe6","name":"Brad","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/learnwebcode.com\/wp-content\/uploads\/0UWl0Tet_400x400.jpg","url":"https:\/\/learnwebcode.com\/wp-content\/uploads\/0UWl0Tet_400x400.jpg","contentUrl":"https:\/\/learnwebcode.com\/wp-content\/uploads\/0UWl0Tet_400x400.jpg","width":400,"height":400,"caption":"Brad"},"logo":{"@id":"https:\/\/learnwebcode.com\/wp-content\/uploads\/0UWl0Tet_400x400.jpg"},"url":"https:\/\/learnwebcode.com\/author\/lwcadmin\/"}]}},"_links":{"self":[{"href":"https:\/\/learnwebcode.com\/wp-json\/wp\/v2\/posts\/31","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/learnwebcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/learnwebcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/learnwebcode.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learnwebcode.com\/wp-json\/wp\/v2\/comments?post=31"}],"version-history":[{"count":9,"href":"https:\/\/learnwebcode.com\/wp-json\/wp\/v2\/posts\/31\/revisions"}],"predecessor-version":[{"id":1014,"href":"https:\/\/learnwebcode.com\/wp-json\/wp\/v2\/posts\/31\/revisions\/1014"}],"wp:attachment":[{"href":"https:\/\/learnwebcode.com\/wp-json\/wp\/v2\/media?parent=31"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/learnwebcode.com\/wp-json\/wp\/v2\/categories?post=31"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/learnwebcode.com\/wp-json\/wp\/v2\/tags?post=31"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}