{"id":59,"date":"2010-11-28T23:38:00","date_gmt":"2010-11-28T23:38:00","guid":{"rendered":"http:\/\/www.codeboss.in\/web-funda\/?p=59"},"modified":"2010-11-28T23:38:00","modified_gmt":"2010-11-28T23:38:00","slug":"div-center-aligned-and-margin-auto-problem-for-ie6-fixed","status":"publish","type":"post","link":"https:\/\/codeboss.in\/web-funda\/2010\/11\/28\/div-center-aligned-and-margin-auto-problem-for-ie6-fixed\/","title":{"rendered":"Div Center Aligned And Margin Auto Problem For IE6 Fixed"},"content":{"rendered":"<p>If you want to place your div in the center of its container with the help of CSS, you can do so following below process &#8211;<\/p>\n<pre class=\"brush: html;\">\n<style>\n.outer\n{\nborder:1px solid #000000; width:600px; margin:0 auto;\n}\n.inner\n{\nborder:1px solid #ff0000; width:300px; margin:0 auto;\n}\n<\/style>\n<div class=\"outer\">\n<div class=\"inner\">\nHi\n<\/div>\n<\/div>\n<\/pre>\n<p>margin 0 sets the margin to 0px and auto sets equal space on either side of the div making it center aligned.<br \/>Here both the outer and inner div will be center aligned. The borders are given so that the div blocks can be identified easily.<br \/>If we remove margin:0 auto; from the outer class, the outer div will be left aligned with inner div center aligned within it.<br \/>For the margin auto to function properly the div must have lesser width than its container. <\/p>\n<p><b>Problem in IE6<\/b><\/p>\n<p>In IE6 sometimes the div gets left aligned even after setting margin auto. This happens if the DTD is not defined properly. If you face this problem in IE6 please provide a valid doctype and the div should be aligned center.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you want to place your div in the center of its container with the help of CSS, you can do so following below process &#8211; Hi margin 0 sets the margin to 0px and auto sets equal space on either side of the div making it center aligned.Here both the outer and inner div&hellip; <a class=\"more-link\" href=\"https:\/\/codeboss.in\/web-funda\/2010\/11\/28\/div-center-aligned-and-margin-auto-problem-for-ie6-fixed\/\">Continue reading <span class=\"screen-reader-text\">Div Center Aligned And Margin Auto Problem For IE6 Fixed<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[31,36,48,49],"class_list":["post-59","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-browser","tag-css","tag-html","tag-ie","entry"],"_links":{"self":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts\/59","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/comments?post=59"}],"version-history":[{"count":0,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts\/59\/revisions"}],"wp:attachment":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/media?parent=59"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/categories?post=59"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/tags?post=59"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}