CSS - Can't Get Wordpress To Center Image!
I've checked the class, and it's peachy, I've added a style= "margin: 0 auto;" tag, a style="text-align: center;" tag.
I've tried everything I can think of. The image isn't receiving any parent styling that is holding it back from centering that I am aware of. Will somebody please learn me! URL is : www . dalcon .com / business / skype-for-asterisk/ the image I'm referring to is the skype for asterisk image. Sorry about broken link, I don't have the rep around here to not be considered a spammer yet I guess (it won't let me post a link) Similar TutorialsI know there has to be an easy answer to this question but I'm at a loss! How do I center an image using CSS? Thanks! BB Hello guys, I have beginner CSS experience. I am using a free wordpress theme. I have begun to modify the theme and have run into a problem. I have checked all over the web for resources to resolve this issue to no avail. I have used the CSS Validator and received some errors nothing that affects this. ISSUE: When clicking "Read More" the image appears twice, once as the limited size and once as the full size. I would like only the first image to appear not the full size one too. SITE: havenhart[dot] com Any help would be super. Hi all, This is probably simple, but I can't get it working for some reason. At http://www.bartlett-family.net/chri...ett/index2.html I want the 8 image links below the "Quote of the moment" to be centered between the vertical lines. I'd appreciate help. CSS is here and the class in "centerinline". I have used an image file "picture.PNG" like this : <h1><img src="picture.PNG" /></h1> then the css is h1{ text-align: center; margin: 20px; padding: 10px; height: 100px; } But it will not align the image in the center ? Am i going about this the wrong way ? or is it just a syntax error ? I'm working with a php script that i purchased. In my admin_login.php page is the entry for the image and my entry from my layout.css page. I'm only seeing half my background image. I cant seem to get it centered. admin_login.php... 5.<div id="container_login"> 6. <a href="http://www.myglobalpnr.com" target="_blank" id="login_logo"><img src="<?php echo IMG_PATH; ?>login_logo.jpg" alt="Property Listing Script by ClassifiedsGeek.com" /></a> 7. <div id="main_login"> 8. <?php require $content_tpl; ?> 9. </div> <!-- main_login --> 10. </div> <!-- container_login --> 11. 12.layout.css... 13. 14./* login */ 15.#container_login{ 16. font-family: Arial, sans-serif; 17. font-size: 12px; 18. margin: 0 auto; 19. overflow: hidden; 20. position: relative; 21. max-width: 100%; 22. height: 1306px; 23.} 24.a#login_logo{ 25. position: absolute; 26. top: 0; 27. left: 404px; 28. height: 129px; 29. margin: 0 auto; 30. width: 192px; 31.} 32.#container_login #main_login{ 33. float: none; 34. margin: 200px auto 0; 35. position: relative; 36. text-align: left; 37. width: 343px; 38.} 39.#container_login h3{ 40. font-size: 1.3em; 41. font-weight: bold; 42. margin: 5px 15px; 43. text-transform: uppercase; I know there's one thing that i didn't do. Can you help me please? Thanks in advance, Scotty13 How would I center an image vertically in a div that has varying height? Normally I would set a line-height and then a vertical-align but the container is of varying size dependent on content . The only way I can think of is to make the image a background and do background-position: center center; Is that the only workaround? After much, much reading, I am still having this problem: I have a background image that i want centered horizontally on the page. You can see what i'm trying to accomplish at stipepainting.com From there i understand how to nest menus and content at the right position on the background. I just can't start by centering the image. this is what i have: Code: <body> <div id="A"> <center> <img src="background.gif"> </center> <div id="A1"> Content text. </div> </div> </body> and here is the css: Code: #A { position: absolute; width: 300px; height: 200px; } #A1 { position: absolute; left: 150px; top: 150px; width: 200px; height: 100px; } I have read a bunch of links suggested by posters, and can't quite find out the answer. I think it would be about 3 lines of code, and if someone could just give me that, i won't need to take another asprin. thanks I have a problem with my background image. I need to centre the background image and center the container div on top of that. I have used the below CSS which has the desired effect in Mozilla but for some reason in ie, the background moves depending on browser size when it needs to stay put! Any ideas? body { font-size: 0.70em; font-family: Arial, Helvetica, sans-serif; text-align: center; background:#ffffff url('../images/content_bg.gif') top center no-repeat; color: #303030; height:100%; min-height:100%; } #container { width: 900px; text-align:left; position: absolute; margin-left:-450px; left:50%; z-index: 100; } BIO BIO CSS i would like for both the image and text to be centered on page-- they are just a little off.... am using FOX as primary browser -- but IE displays pretty much the same-- anyone got a fix for this??? its late and i have been over the coding a million times but just dont see the solution it right now thanks in advance! I am trying to get the background image for #feature-stripe to be fluid. I want it to expand and contract equally with the images just above and below it. The other images are in the #banner & #main-center. I can't seem to get the #feature-stripe to do the same. Also, I am using the #main-left as a placeholder for position. I tried to eliminate it, but things to line back up like I think they should. Side note: I am using XHTML 1.0 Strict DTD. Any help or if someone could point me in the right direction I would appreciate it. CSS Code: Original - CSS Code body { margin: 0px 0px 0px 0px; padding: 0px; background: #431111; } #main-right { width: 20%; float: left; background: url('column_background2.png') repeat; overflow: hidden; padding-bottom: 5px; } #main-right p{ padding: 5px 10px 5px 10px; } #main-center { width: 60%; float: left; margin-left: auto; margin-right: auto; background: #000; padding-bottom: 0px; } #main-center #img { margin-left: 0%; } #main-left { width: 10%; float: left; /*background: #fff; */ padding-bottom: 10px; } #banner { background: #000 url('front-basket_1.png') no-repeat; height: 9.7em; width: 80%; margin-left: auto; margin-right: auto; color: gold; } #banner #right { float:right; width: 25%; height: 9.7em; background: url('column_background2.png') repeat; margin:0px 0px 10px 10px; } #banner #right p{ padding: 5px 10px 5px 10px; } #feature-stripe { background: #5B0E0E url('front-basket_2.png') no-repeat; background-position: 12.7% 0%; height: 20px; } body { Code: XHTML <div id="banner"><div id="right"></div></div> <div id="feature-stripe"></div> <div id="main-left"></div> <div id="main-center"><div id="img"><img src="front-basket_3.png" alt="" /></div></div> <div id="main-right">This is the main right</div> Edit: Currently I am getting this to work in Firefox. I will worry about the others later. Therefore, I may be back with more questions later. Hi, Here's the site I'm working with: http://www.cjfusion.com I want to get that image centered on the browser window and then depending on how big the viewers screen is, the browser will cover up the left and the right. I hope that makes sense. I almost want it to be fluid, but I'm unsure how to do that. Ask questions if this doesnt make sense. Its hard to explain. -CJ It seems I get one or the other, but not all. I'm trying to position the image below vertically center and horizontally left to no avail. Its horizontally left but centers the top of the image in the center of the page. What am I doing wrong? <DIV style="position: absolute; top: 50%; left: 0px; border: none"><img src="images/right.jpg"></img></DIV> I've tried margin: 0 auto; and that didn't work. I am using the following code how do I change it so that it would show up in the center of the brower window? Thanks Tim PHP Code: <div style="position: absolute; left: 0px; z-index: 1; top: 0px; align: center\"> <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0 ,0\" width=\"544\" height=\"396\" id=\"cardio\" align=\"middle\"> <param name=\"allowScriptAccess\" value=\"sameDomain\" /> <param name=\"movie\" value=\"ads/cardio3.swf\" /> <param name=\"loop\" value=\"false\" /> <param name=\"quality\" value=\"high\" /> <param name=\"wmode\" value=\"transparent\" /> <param name=\"bgcolor\" value=\"#ffffff\" /> <embed src=\"ads/cardio3.swf\" loop=\"false\" quality=\"high\" wmode=\"transparent\" bgcolor=\"#ffffff\" width=\"544\" height=\"396\" name=\"cardio\" align=\"middle\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" /> </object> </div> I'm using a relative-positioned div as a container for an image, which is absolute-positioned. I'm doing this so that the image will automatically scale down to fit inside the containing div (nothing else I've tried has done this for me- so if there is another way to achieve this, please fill me in). This part works fine, but the image isn't as wide as the containing div, so I would like to center the image inside the div- but I can't seem to get it to work. I tried the obvious text-align:center in the div. That actually worked... kinda. The image's left-side was in the center of the div, but obviously isn't the 'centering' that I'm looking for. I then tried setting margin-left and margin-right on the image to auto, and that did nothing. I suspect that the fact that I have my image absolute-positioned is the culprit here, but I don't know how to get around it- or IF I can get around it without drastically changing my approach. Admittedly, the container div resides inside a table cell. I know that isn't the best practice, but I spent so much time trying a div-only approach only to waste time and become frustrated that I went back to what I know works- at least for now. I tried removing the container div from the table and inserting the image directly to the table cell- but encountered more issues with the sizing of the image. Essentially, my code is something like this: CSS: Code: td#CONTENTDISPLAY { width: 100%; height: 100%; text-align: left; vertical-align: top; padding: 0 0 0 0; margin: 0 0 0 0; } div#CONTENTBANNER { position: relative; height: 100%; padding: 0 0 0 0; } img.CONTENTIMG { position: absolute; height: 100%; } HTML: Code: ... <td id="CONTENTDISPLAY"> <div id="CONTENTBANNER"> <img class="CONTENTIMG" /> </div> </td> ... Nothing flashy, I know. One thing I should mention, however, is that the image is ALWAYS placed inside the container div using a Javascript function (it's a dynamic image). I doubt that makes a difference, but I figure it's worth mentioning. Can anyone help point me in the right direction? Thanks! - skubik Hi, I have a front page which is one image only, no text. The image is centered horizontally (i.e. a simply text-align: center; ). My question is - how do I centre it vertically? (no matter what the resolution of the website visitor is). i.e. Currently the image is at the top of my screen. I would like it to be in the centre, both horizontally and vertically. Many thanks! Here is the blog page: wavgirl.com/blog If you open it in firefox or other browsers, it works fine. The menu at the top is on all pages on my site (via a php include). All pages also are linked to a main stylesheet for my website. Everything works in internet explorer EXCEPT that blog page (if you go to the main page of my site in IE, it loads fine). This has led me to conclude that there is something specifically in the blog's style sheet that doesn't work in IE. When you load the blog page in IE, the page is thrown off center, and the menu dropdown does not work anymore. Can someone simply look at this stylesheet and tell me how to correct it for internet explorer? As I said, all of this loads fine in other browsers, and the menu works on all other pages of the site in any browser. Any help would be appreciated, and I apologize if I posted this in the wrong place. Code: /* Theme Name: Simple Blog Design Theme URI: Description: A simple clear theme with 2-sidebar and 3-sidebar layouts. Version: 1.0 Author: BlogDesignStudio Author URI: http://blogdesignstudio.com/ Tags: widget ready, white, blue, right sidebar Valid XHTML 1.0 Transitional */ * { margin: 0; padding: 0; } body { color: #000; background: #fff; font-family: Verdana, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif; font-size: 70%; line-height: 1.6; } p { font-size: 1.1em; margin: 0 0 10px 0; } blockquote { background: url(images/quote.png) no-repeat; color: #000; margin: 15px; padding-left: 25px; } em { font-style: italic; } strong { font-weight: 700; } pre, code { font-family: Verdana, "Courier New", Courier, Monospace; line-height: 1.5; } pre { border-top: 1px solid #ccc; white-space: pre; overflow: auto; margin: 0 15px; padding: 10px 15px; max-height: 300px; } img { } a { color: #555555!important; text-decoration: none; outline: none; } a:focus, a:hover { color: #555555!important; text-decoration: none; } .clear { float:none; clear: both; } .aligncenter, div.aligncenter { display: block; margin-left: auto; margin-right: auto; } .alignleft { float: left; } .alignright { float: right; } .wp-caption { border: 1px solid #ddd; text-align: center; background-color: #f3f3f3; padding-top: 4px; margin: 10px; } .wp-caption img { margin: 0; padding: 0; border: 0 none; } .wp-caption p.wp-caption-text { font-size: 11px; line-height: 17px; padding: 0 4px 5px; margin: 0; } img.alignleft { margin:5px 10px 10px 0; } img.alignright { margin:5px 0 10px 10px; } hr { background: #E6E6D2; color: #E6E6D2; clear: both; float: none; width: 100%; height: .1em; margin: 0 0 1.4em; border: none; } hr.space { height: 4em; } .clearer { clear:both; } /************************* HOLDERS ********************************/ .container { text-align: left; background: #fff; min-height: 100%; max-width: 1000px; padding-left: 20px; padding-right: 20px; margin: 0; margin: 0 auto; } .container2 { width: 100%; margin: 0 auto; text-align:left; } /************************* HEADER ********************************/ .blender { background: #eae0da; } #header { width: 100%; } #header .container { width: 980px; } #headline { float:left; margin:15px 0 20px 20px; font-size:16px; color:#a6a379; } #headline h1 { font-size:40px; line-height:40px; margin:0; color:#3e4b54; letter-spacing:-1px; } /************************* SUBSCRIBE START ********************************/ .subs { display:block; float:right; width:280px; } .subs a { margin:10px 0 0 0; padding:0 0 0 25px; height:20px; display:block; float:left; background:url(images/rss.gif) left top no-repeat; } /************************* SUBSCRIBE END ********************************/ /************************* PAGES MENU START ********************************/ .topline { height:40px; background:#3E4B54; } ul.menu { width:980px; list-style-type: none; margin: 0px auto; padding:0; font-weight:normal; height:40px; } ul.menu li.page_item { float: left; display: inline; font-size: 18px; margin:0 1px 0 0; padding:0; text-transform:uppercase; } ul.menu li.page_item a { color:#fff!important; display: block; float:left; text-decoration: none; padding:6px 20px 5px 20px; } ul.menu li.page_item a:hover { color: #3e4b54!important; text-decoration:none; background:#E6E2D9; } ul.menu li.current_page_item a { color: #3e4b54!important; text-decoration:none; background:#E6E2D9; } /************************* PAGES MENU END ********************************/ /* Search */ #searchform { padding:0; margin:10px 0 0 0; display:block; float:left; clear:both; width:250px; height:33px; font-size:15px; color:#003e4f; } input#s { width: 240px; float:left; margin:5px 7px 0 0; padding:4px 5px 6px 5px; font-family: Verdana, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif; border:none; font-size:14px; background:#fff; color:white; } /************************* CONTENT PACKER ********************************/ #leftcolumn, #rightcolumn { margin:0; } #leftcolumn { float: left; width: 70%; padding:0; } #leftcolumn_top { height:6px; margin-bottom:15px; } #leftcolumn_bot { height:6px; margin-top:30px; } #rightcolumn { float: right; width: 29%; margin:0; } .sidebar_left { display:none; } /************************* CONTENT START ********************************/ .title { margin:0; clear:both; } .title h2 { color: #3e4b54; } .title h2 a { color: #3e4b54!important; text-decoration: none; } .title h2 a:hover { color: #3e4b54!important; text-decoration: none; border-bottom:1px dotted #3e4b54!important; } .date { color:#555555; margin-bottom:10px; } .post { padding: 0; margin:0 23px 10px 20px; clear:both; } .post p { padding:0; margin:0; } .postdata { margin: 10px 0 20px 0; padding:0 10px 3px 10px; float:left; font-size:12px; background:#eae0da; color:#000; width:97%; } a.more-link { display:block; clear:both; color:#a6a379; margin:10px 0 20px 0; width:135px; } a:hover.more-link { color:#a6a379; } #related h3, h3#comments { padding: 8px 0 5px 0; border-bottom:1px dotted #999; } .cmd-avatar { clear: none; display: inline; float: right; margin: 0px; } /************************* CONTENT END ********************************/ /************************* SIDEBAR MAINS START ********************************/ ul.sidebar { list-style-type: none; margin: 0 0 0px 0; padding: 0; } .sidebar li { padding:0; margin:0; } li.widget ul { list-style-type: none; margin: 0 0 30px 0; padding: 0; font-size:15px; } .sidebar ul li { margin: 5px 0 5px 0; } .sidebar .children { margin: 0 0 10px 10px; } .sidebar h2 { letter-spacing:-1px; } .sidebar a { color: #000!important; padding:4px 5px 6px 15px; font-size:14px; background-position:0 6px; } .sidebar a:hover { color:#555555!important; background-position:0 6px; } /************************* SIDEBAR MAINS END ********************************/ #tag_cloud { display:block; margin-bottom:30px; float:left; clear:both; width:100%; } ul#recentcomments { width:210px; } ul#recentcomments li { background-position:0 5px; padding-left:15px; } #recentcomments a { background:none; padding-left:0; } #recentcomments a:hover { background:none } #tag_cloud a { margin-right:5px; } /************************* COMMENTS AREA START ********************************/ .commentlist { margin: 0; padding:0; list-style-type:none; } .commentlist p { padding:5px; margin:0; } .komentar { margin:0; padding:0; } .commentlist a { border-bottom:1px dotted; } .commentlist a:hover { text-decoration:none; border-bottom:none; } .commentlist .body { padding: 0; margin:0; overflow: hidden; float:right; width:580px; display:block; text-align:justify; color:#45322f; } .commentlist .body .body-author { padding: 0; margin:0; overflow: hidden; color:#555555; float:left; display:block; } .commentlist .body p { float:left; padding-top:0; } .commentlist li { width: 100%; padding: 0 0 5px 0; clear:both; display:block; float:left; font-size:11px; } .commentlist li .top { color: #45322f; padding: 0; margin:0; width:575px; float:right; font-weight: bold; } .commentlist li .top a { color: #555555; } .commentlist li .top span { font-size: 0.9em; font-weight: 400; color:#505e66; } .gravatar { height:70px; width:60px; float:left; margin:0; } img.avatar { margin:0; height:60px; width:60px; padding:2px; border:1px solid #E5E1DE; } .theform { padding: 1.5em 0 2em; } .theform label { font-size: 0.9em; vertical-align: middle; } #remember, #forget, #txpCommentHelpLink { margin-left: 2em; } #commentform { padding:0; } #commentform input:focus, #commentform textarea:focus { border: 1px solid #CECABE; background: white; } .comment_input { vertical-align: middle; width: 260px; border: 1px solid #ffffff; background: #ffffff; padding: 0.3em; margin-right: 5px; margin-bottom:10px; } .message_input { font-size: 1em; width: 98%; height: 200px; border: 1px solid #CECABE; background: #ffffff; margin-top: 0.2em; margin-bottom:10px; padding: 0.3em; } .commentlist_error { color: #c00; } .button { background: #fff; width:75px; padding:5px 0 5px 0; border:1px solid #CECABE; color:#6000; font-weight:bold; text-transform:uppercase; font-size:12px; cursor:pointer; } .button:hover { background: #555555; color:white; cursor:pointer; } #commentform .button:focus { background: #cccccc; color:white; cursor:pointer; border:1px solid #CECABE; } /************************* COMMENTS AREA END ********************************/ /************************* FOOTER START ********************************/ #footer { width: 992px; margin:0px auto; padding:10px 0 20px 0; display: block; } #footer .container { padding:0; width:950px; } .copyright { float:left; color:#a4a093; font-size:11px; margin-bottom:10px; } #footer .credits { float:left; color:#a4a093; } #footer .credits p { float:left; font-size:12px; margin:6px 5px 0 0; } #footer .credits a, #footer .credits a:visited { text-decoration:none; } a.wordpress { display:block; float:left; width:25px; height:25px; background:url(images/wordpress.gif) no-repeat; color:#ccc!important; padding-left:26px; line-height:30px; } a:hover.wordpress { background:url(images/wordpress.gif) no-repeat 0 100%; color:#000!important; } /************************* FOOTER END ********************************/ /*************** SOCIAL LINKS ************************/ .inside_subpost { display:block; clear:both; margin:30px 23px 30px 20px; padding:0; } .related_rss_icon { float:left; background:url(images/rss.gif) no-repeat; width:25px; height:20px; border-bottom:none; } .related_rss { padding:0; margin:0 0 20px 0; font-size:18px; font-weight:normal; border-bottom:none; } .related_rss a, .related_rss a:visited { border-bottom:1px dotted; } .related_rss a:hover { border-bottom:none; text-decoration:none; } .social { margin:0; padding:0; float:left; margin-right:30px; } /*************** END SOCIAL LINKS ************************/ #calendar_wrap { margin:0px auto; width:210px; margin-bottom:30px; clear:both; } #calendar_wrap a { padding: 3px 0px; background:none } #calendar_wrap table { width: 210px; border: solid 1px #ccc; background:#f7f7f7} #calendar_wrap caption { padding: 5px 0px; width: 210px; color:#585449; font-size:14px; font-weight:bold; } #calendar_wrap table th { text-align: center; letter-spacing: -1px; padding: 0px; font-size:12px; color:#585449; height:30px; } #calendar_wrap table td { text-align: center; border: solid 1px #ccc; padding: 3px; font-size: 12px; color:#585449} #calendar_wrap table td a { font-size: 12px; font-weight:bold;} #calendar_wrap table td a:hover { color:#9CC318; font-weight:bold; border:none; } /* Page Navigation +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ .pageNav { padding: 5px 0 0 0; margin:30px 23px 20px 20px; height:30px; font-size:15px; } .pageNav a, .pageNav a:visited { display:block; float:left; text-align:center; line-height:25px; height:25px; width:25px; color:#3A3A3A; text-decoration:none; } .pageNav a:hover { text-decoration: none; color:#a6a379; border-bottom:1px dashed #a6a379; } .pageNav span { display:block; float:left; text-align:center; line-height:25px; height:25px; width:130px; color:#333;} .pageNav .on { display:block; float:left; text-align:center; line-height:25px; height:25px; width:25px; color:#a6a379; } .dotts {width:25px; text-align:center; display:block; float:left;} .pageNav a.lastpage {color: #3a3a3a;width:35px;} .pageNav a:hover.lastpage {color: #222; width:35px;} #singleNav { margin:20px; } .previous { float:left; } .next { float:right; } .list404-table { font-size:17px; } ul.list404, ul.list404 li ul { list-style-type:none; font-size:14px; margin:10px 20px 20px 20px; } ul.list404 li a { background-position:0 4px; padding-left:20px; } ul.list404 li a:hover { background-position:0 4px; } I'm using wordpress 2.9 and I installed a plugin called wp-polls the problem is that the Y in Yes and N in No on the poll won't show up in IE. the url is mcs.assistui.net How do you fix this? |