{"id":161,"date":"2009-12-29T19:44:00","date_gmt":"2009-12-30T00:44:00","guid":{"rendered":"http:\/\/madprogrammer76.wordpress.com\/2009\/12\/30\/html-centering-div-tag-div-element"},"modified":"2013-12-15T21:15:05","modified_gmt":"2013-12-16T02:15:05","slug":"html-centering-div-tag-div-element","status":"publish","type":"post","link":"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/","title":{"rendered":"HTML Centering DIV Tag ( DIV Element )"},"content":{"rendered":"<p>The easiest way without JavaScript to center a DIV tag is to use a style tag or css that resembles the following.<\/p>\n<div style=\"background-color:wheat;padding:5px 10px;\">style=&#8217;padding:5px;width: 400px;height:200px; margin-top:-100px; margin-left:-200px; left:50%;top:50%; border:outset 1px #ccff99; background-color:#ccff99;position:absolute;font-weight:normal;&#8217;<\/div>\n<p><b>Sample Image<\/b><br \/><a href=\"http:\/\/www.unlatched.com\/blog\/uploaded_images\/sample-750305.png\"><img decoding=\"async\" src=\"http:\/\/www.unlatched.com\/blog\/uploaded_images\/sample-750301.png\" border=\"0\" alt=\"\" \/><\/a><\/p>\n<div class=\"blogger-post-footer\"><img width='1' height='1' src='' alt='' \/><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The easiest way without JavaScript to center a DIV tag is to use a style tag or css that resembles the following. style=&#8217;padding:5px;width: 400px;height:200px; margin-top:-100px; margin-left:-200px; left:50%;top:50%; border:outset 1px #ccff99; background-color:#ccff99;position:absolute;font-weight:normal;&#8217; Sample Image<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[112,141,96],"tags":[170,169,110,253,168,120,252],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\r\n<title>HTML Centering DIV Tag ( DIV Element ) - LDNDeveloper<\/title>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"HTML Centering DIV Tag ( DIV Element ) - LDNDeveloper\" \/>\r\n<meta property=\"og:description\" content=\"The easiest way without JavaScript to center a DIV tag is to use a style tag or css that resembles the following. style=&#8217;padding:5px;width: 400px;height:200px; margin-top:-100px; margin-left:-200px; left:50%;top:50%; border:outset 1px #ccff99; background-color:#ccff99;position:absolute;font-weight:normal;&#8217; Sample Image\" \/>\r\n<meta property=\"og:url\" content=\"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/\" \/>\r\n<meta property=\"og:site_name\" content=\"LDNDeveloper\" \/>\r\n<meta property=\"article:published_time\" content=\"2009-12-30T00:44:00+00:00\" \/>\r\n<meta property=\"article:modified_time\" content=\"2013-12-16T02:15:05+00:00\" \/>\r\n<meta property=\"og:image\" content=\"http:\/\/www.unlatched.com\/blog\/uploaded_images\/sample-750301.png\" \/>\r\n<meta name=\"author\" content=\"andrewpallant\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:creator\" content=\"@ldnDeveloper\" \/>\r\n<meta name=\"twitter:site\" content=\"@LdnDeveloper\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"andrewpallant\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/\"},\"author\":{\"name\":\"andrewpallant\",\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/0e7b5e71751000e8f66b17b69ef4ab97\"},\"headline\":\"HTML Centering DIV Tag ( DIV Element )\",\"datePublished\":\"2009-12-30T00:44:00+00:00\",\"dateModified\":\"2013-12-16T02:15:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/\"},\"wordCount\":55,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84\"},\"image\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.unlatched.com\/blog\/uploaded_images\/sample-750301.png\",\"keywords\":[\"center\",\"centering\",\"CSS\",\"Design\",\"element\",\"HTML\",\"Web\"],\"articleSection\":[\"Design\",\"Developement\",\"Web\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/\",\"url\":\"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/\",\"name\":\"HTML Centering DIV Tag ( DIV Element ) - LDNDeveloper\",\"isPartOf\":{\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#primaryimage\"},\"image\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.unlatched.com\/blog\/uploaded_images\/sample-750301.png\",\"datePublished\":\"2009-12-30T00:44:00+00:00\",\"dateModified\":\"2013-12-16T02:15:05+00:00\",\"breadcrumb\":{\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#primaryimage\",\"url\":\"http:\/\/www.unlatched.com\/blog\/uploaded_images\/sample-750301.png\",\"contentUrl\":\"http:\/\/www.unlatched.com\/blog\/uploaded_images\/sample-750301.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/andrewpallant.ca\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HTML Centering DIV Tag ( DIV Element )\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#website\",\"url\":\"https:\/\/andrewpallant.ca\/wordpress\/\",\"name\":\"LDNDeveloper\",\"description\":\"Learning, Growing and Sharing.\",\"publisher\":{\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/andrewpallant.ca\/wordpress\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84\",\"name\":\"ldnDeveloper\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/andrewpallant.ca\/wordpress\/wp-content\/uploads\/2017\/05\/cropped-AAEAAQAAAAAAAAXQAAAAJDQxMGRlMzFjLWM4ODctNDk1NC05M2EyLWE1NDNhNTRiZjVlYw-2.jpg\",\"contentUrl\":\"https:\/\/andrewpallant.ca\/wordpress\/wp-content\/uploads\/2017\/05\/cropped-AAEAAQAAAAAAAAXQAAAAJDQxMGRlMzFjLWM4ODctNDk1NC05M2EyLWE1NDNhNTRiZjVlYw-2.jpg\",\"width\":512,\"height\":512,\"caption\":\"ldnDeveloper\"},\"logo\":{\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/\"},\"description\":\"Andrew Pallant (@LdnDeveloper) has been a web, database and desktop developer for over 16 years. Andrew has worked on projects that ranged from factory automation to writing business applications. Most recently he has been heavily involved in various forms for ecommerce projects. Over the years Andrew has worn many hats: Project Manager, IT Manager, Lead Developer, Supervisor of Developers and many more - See more at: http:\/\/www.unlatched.com\/#sthash.8DiTkpKy.dpuf\",\"sameAs\":[\"http:\/\/www.andrewpallant.ca\",\"https:\/\/x.com\/LdnDeveloper\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/0e7b5e71751000e8f66b17b69ef4ab97\",\"name\":\"andrewpallant\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/1.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/1.gravatar.com\/avatar\/?s=96&d=mm&r=g\",\"caption\":\"andrewpallant\"},\"url\":\"http:\/\/andrewpallant.ca\/wordpress\/author\/andrewpallant\/\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HTML Centering DIV Tag ( DIV Element ) - LDNDeveloper","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":"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/","og_locale":"en_US","og_type":"article","og_title":"HTML Centering DIV Tag ( DIV Element ) - LDNDeveloper","og_description":"The easiest way without JavaScript to center a DIV tag is to use a style tag or css that resembles the following. style=&#8217;padding:5px;width: 400px;height:200px; margin-top:-100px; margin-left:-200px; left:50%;top:50%; border:outset 1px #ccff99; background-color:#ccff99;position:absolute;font-weight:normal;&#8217; Sample Image","og_url":"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/","og_site_name":"LDNDeveloper","article_published_time":"2009-12-30T00:44:00+00:00","article_modified_time":"2013-12-16T02:15:05+00:00","og_image":[{"url":"http:\/\/www.unlatched.com\/blog\/uploaded_images\/sample-750301.png"}],"author":"andrewpallant","twitter_card":"summary_large_image","twitter_creator":"@ldnDeveloper","twitter_site":"@LdnDeveloper","twitter_misc":{"Written by":"andrewpallant"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#article","isPartOf":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/"},"author":{"name":"andrewpallant","@id":"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/0e7b5e71751000e8f66b17b69ef4ab97"},"headline":"HTML Centering DIV Tag ( DIV Element )","datePublished":"2009-12-30T00:44:00+00:00","dateModified":"2013-12-16T02:15:05+00:00","mainEntityOfPage":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/"},"wordCount":55,"commentCount":0,"publisher":{"@id":"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84"},"image":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#primaryimage"},"thumbnailUrl":"http:\/\/www.unlatched.com\/blog\/uploaded_images\/sample-750301.png","keywords":["center","centering","CSS","Design","element","HTML","Web"],"articleSection":["Design","Developement","Web"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#respond"]}]},{"@type":"WebPage","@id":"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/","url":"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/","name":"HTML Centering DIV Tag ( DIV Element ) - LDNDeveloper","isPartOf":{"@id":"https:\/\/andrewpallant.ca\/wordpress\/#website"},"primaryImageOfPage":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#primaryimage"},"image":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#primaryimage"},"thumbnailUrl":"http:\/\/www.unlatched.com\/blog\/uploaded_images\/sample-750301.png","datePublished":"2009-12-30T00:44:00+00:00","dateModified":"2013-12-16T02:15:05+00:00","breadcrumb":{"@id":"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#primaryimage","url":"http:\/\/www.unlatched.com\/blog\/uploaded_images\/sample-750301.png","contentUrl":"http:\/\/www.unlatched.com\/blog\/uploaded_images\/sample-750301.png"},{"@type":"BreadcrumbList","@id":"http:\/\/andrewpallant.ca\/wordpress\/html-centering-div-tag-div-element\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/andrewpallant.ca\/wordpress\/"},{"@type":"ListItem","position":2,"name":"HTML Centering DIV Tag ( DIV Element )"}]},{"@type":"WebSite","@id":"https:\/\/andrewpallant.ca\/wordpress\/#website","url":"https:\/\/andrewpallant.ca\/wordpress\/","name":"LDNDeveloper","description":"Learning, Growing and Sharing.","publisher":{"@id":"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/andrewpallant.ca\/wordpress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/f6f5bb1ac3e0c5a54a8b5ce35fd67b84","name":"ldnDeveloper","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/","url":"https:\/\/andrewpallant.ca\/wordpress\/wp-content\/uploads\/2017\/05\/cropped-AAEAAQAAAAAAAAXQAAAAJDQxMGRlMzFjLWM4ODctNDk1NC05M2EyLWE1NDNhNTRiZjVlYw-2.jpg","contentUrl":"https:\/\/andrewpallant.ca\/wordpress\/wp-content\/uploads\/2017\/05\/cropped-AAEAAQAAAAAAAAXQAAAAJDQxMGRlMzFjLWM4ODctNDk1NC05M2EyLWE1NDNhNTRiZjVlYw-2.jpg","width":512,"height":512,"caption":"ldnDeveloper"},"logo":{"@id":"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/"},"description":"Andrew Pallant (@LdnDeveloper) has been a web, database and desktop developer for over 16 years. Andrew has worked on projects that ranged from factory automation to writing business applications. Most recently he has been heavily involved in various forms for ecommerce projects. Over the years Andrew has worn many hats: Project Manager, IT Manager, Lead Developer, Supervisor of Developers and many more - See more at: http:\/\/www.unlatched.com\/#sthash.8DiTkpKy.dpuf","sameAs":["http:\/\/www.andrewpallant.ca","https:\/\/x.com\/LdnDeveloper"]},{"@type":"Person","@id":"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/0e7b5e71751000e8f66b17b69ef4ab97","name":"andrewpallant","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/andrewpallant.ca\/wordpress\/#\/schema\/person\/image\/","url":"http:\/\/1.gravatar.com\/avatar\/?s=96&d=mm&r=g","contentUrl":"http:\/\/1.gravatar.com\/avatar\/?s=96&d=mm&r=g","caption":"andrewpallant"},"url":"http:\/\/andrewpallant.ca\/wordpress\/author\/andrewpallant\/"}]}},"_links":{"self":[{"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/posts\/161"}],"collection":[{"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/comments?post=161"}],"version-history":[{"count":2,"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/posts\/161\/revisions"}],"predecessor-version":[{"id":1127,"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/posts\/161\/revisions\/1127"}],"wp:attachment":[{"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/media?parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/categories?post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/andrewpallant.ca\/wordpress\/wp-json\/wp\/v2\/tags?post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}