{"id":96,"date":"2011-05-05T10:27:04","date_gmt":"2011-05-05T10:27:04","guid":{"rendered":"http:\/\/pixert.com\/blog\/?p=96"},"modified":"2011-08-11T06:03:39","modified_gmt":"2011-08-11T06:03:39","slug":"center-images-with-css","status":"publish","type":"post","link":"https:\/\/pixert.com\/blog\/center-images-with-css\/","title":{"rendered":"Center Images with CSS"},"content":{"rendered":"<p><a href=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/do-you-have-facebook.jpg\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"44\" data-permalink=\"https:\/\/pixert.com\/blog\/add-facebook-like-to-wordpress\/do-you-have-facebook\/\" data-orig-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/do-you-have-facebook.jpg?fit=500%2C373&amp;ssl=1\" data-orig-size=\"500,373\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"Do You Have a Facebook?\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/do-you-have-facebook.jpg?fit=300%2C223&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/do-you-have-facebook.jpg?fit=500%2C373&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/do-you-have-facebook-300x223.jpg?resize=300%2C223\" alt=\"\" title=\"Do You Have a Facebook?\" width=\"300\" height=\"223\" class=\"aligncenter size-medium wp-image-44\" srcset=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/do-you-have-facebook.jpg?resize=300%2C223&amp;ssl=1 300w, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/do-you-have-facebook.jpg?w=500&amp;ssl=1 500w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><br \/>\n<strong>xHTML code<\/strong><\/p>\n<pre class=\"brush: plain; title: Code Block; notranslate\" title=\"Code Block\">\r\n\r\n&lt;div class=&quot;post&quot;&gt;\r\n\r\n&lt;img src=&quot;http:\/\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/do-you-have-facebook.jpg&quot; \/&gt;\r\n\r\n&lt;\/div&gt;\r\n\r\n<\/pre>\n<p><strong>CSS code<\/strong><\/p>\n<pre class=\"brush: plain; title: Code Block; notranslate\" title=\"Code Block\">\r\n\r\n.post img { display: block; margin-left: auto; margin-right: auto ; }\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>xHTML code &lt;div class=&quot;post&quot;&gt; &lt;img src=&quot;http:\/\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/do-you-have-facebook.jpg&quot; \/&gt; &lt;\/div&gt; CSS code .post img { display: block; margin-left: auto; margin-right: auto ; }<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[54,5],"tags":[55,6,7],"class_list":["post-96","post","type-post","status-publish","format-standard","hentry","category-code-snippet","category-wordpress","tag-code-snippet-2","tag-wordpress-2","tag-wp"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1pvi1-1y","jetpack-related-posts":[{"id":290,"url":"https:\/\/pixert.com\/blog\/override-css-property-right-to-left\/","url_meta":{"origin":96,"position":0},"title":"Override CSS property right to left","author":"Pixel Insert \/ Pixert","date":"March 4, 2013","format":false,"excerpt":"\u00a0 This case is an example on how to override CSS property right to left We have this AdSense banner floating on the right side of the screen. What if you want to change it to the left Recently, I installed Floating AdSense plugin for WordPress. It's very helpful to\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":179,"url":"https:\/\/pixert.com\/blog\/how-to-change-the-bullet-size-and-color-css\/","url_meta":{"origin":96,"position":1},"title":"How to change the bullet size and color with CSS","author":"Pixel Insert \/ Pixert","date":"December 20, 2011","format":false,"excerpt":"The following code snippet help you change the bullet size and color of your unordered lists. We are using simple CSS code to do that 1. Create your bullet list image via Adobe Photoshop or you can use another image editor to do that (e.g Pixelmator). Save the image as\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/12\/csslogo.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":289,"url":"https:\/\/pixert.com\/blog\/full-screen-background-on-wp-login-page\/","url_meta":{"origin":96,"position":2},"title":"Full Screen Background on WP Login Page","author":"Pixel Insert \/ Pixert","date":"March 5, 2013","format":false,"excerpt":"The following function add full screen background on WP Login page 1. Open functions.php in your theme directory 2. Add this function to functions.php [text] \/\/ LOGIN - full background function my_login_style() { ?> <style type=\"text\/css\"> body.login { background:url('http:\/\/yourwebsiteaddress.com\/wp-content\/uploads\/wploginbg.jpg') no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size:\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"WordPress - the logo","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":222,"url":"https:\/\/pixert.com\/blog\/wpzoom-featured-category-widget-videozoom\/","url_meta":{"origin":96,"position":3},"title":"WPZoom Featured Category Widget with video for Videozoom theme","author":"Pixel Insert \/ Pixert","date":"April 6, 2012","format":false,"excerpt":"I made the following widget code to show Featured Category with Video embed code. The following widget works with Videozoom theme from WPZoom Open wpzoom-widgets.php in the functions folder of Videozom. \u00a0Add the following code at the bottom of the wpzoom-widgets.php [php] \/*---------------------------------------------*\/ \/* WPZOOM: Featured Category widget with Video\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":214,"url":"https:\/\/pixert.com\/blog\/how-to-fix-also-bought-noimage-error-wp-ecommerce\/","url_meta":{"origin":96,"position":4},"title":"How to fix &#8220;people who bought this item also bought&#8221; no image error in wp e-commerce","author":"Pixel Insert \/ Pixert","date":"March 23, 2012","format":false,"excerpt":"Cross Sales is a feature under WP E-Commerce . You can find this under Store Settings > Marketing. An user will see what other people bought with regard to the current product being displayed. Upon activating it though, an error, \u201cNO IMAGE\u201d default thumbnail under that category\u00a0which does not display\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":206,"url":"https:\/\/pixert.com\/blog\/how-to-make-ie-to-display-iframes-with-transparent-background\/","url_meta":{"origin":96,"position":5},"title":"How to make IE to display iframes with transparent background?","author":"Pixel Insert \/ Pixert","date":"February 28, 2012","format":false,"excerpt":"1. Add allowTransparency=\"true\" property to the iframe [php]<iframe id=\"frame_one\" src=\"iframe.php\" allowTransparency=\"true\">Browser not compatible<\/iframe>[\/php] 2. Add background:transparent to it's body tag or internal styles in the head section of an HTML page [php]<body style=\"background:transparent\"><\/body>[\/php] or [php] <style type=\"text\/css\"> html,body { background: transparent; } <\/style> [\/php]","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/96","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/comments?post=96"}],"version-history":[{"count":0,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/96\/revisions"}],"wp:attachment":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media?parent=96"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/categories?post=96"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/tags?post=96"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}