Hybridd Posted October 20, 2014 Posted October 20, 2014 trying to put the display image in the middle but image not showing... code is this: <div id='avatar'></div> iv tried this: <div id='avatar'> if($ir['display_pic']) { print"<img src='{$ir['display_pic']}' width='63' height='68' border='0'></a>"; }else{ print "<img src='images/display.png' width='63' height='68' border='0'></a>"; } </div> doesn't work tho Quote
NonStopCoding Posted October 20, 2014 Posted October 20, 2014 yes as zettie said have you used z index this should stack the image on top of it http://www.w3schools.com/cssref/pr_pos_z-index.asp Quote
Hybridd Posted October 20, 2014 Author Posted October 20, 2014 :( nope not worked. code i used: <div id='avatar'> <center> <img src="{$ir['display_pic']}" class='img' width='63' height='68' border='0'></a> </center> </div> css i used: <script> img { position: absolute; background-image: url("{$ir['display_pic']}"); width: 60px; hight: 60px; left: 0px; top: 0px; z-index: -1; } </script> what am i doing wrong? its not showing the image instead it shows a little icon which means image not found or something like that Quote
G7470 Posted October 20, 2014 Posted October 20, 2014 Looks like there are some things wrong with this picture... <script> is the incorrect tag for css. You should use <style> instead to indicate css. So, your css should look like this now: <style> img { position: absolute; background-image: url("{$ir['display_pic']}"); width: 60px; hight: 60px; left: 0px; top: 0px; z-index: -1; } </style> Not sure why you're including PHP code in the css. This really should not be necessary. Also, not sure what was originally in the "background-image" property (if any), but this should not be changed. So, with this in mind, your css should now look like this:<style> img { position: absolute; background-image: (what was originally here. if none, delete this property) width: 60px; hight: 60px; left: 0px; top: 0px; z-index: -1; } </style> Verify that the path to the avatar images is correct (if uploaded). If the value of $ir['display_pic']} is only the file name for an uploaded image, this will not work with how it is currently coded. Do realize that by adding css to the <img> tag (which you are doing with that css) that this will change the properties for ALL images that are coded in such a fashion regardless of what they are. If you have taken this into account, then that's good! Feel free to respond to this post or PM me if you have any questions. :) ~G7470 Quote
Hybridd Posted October 20, 2014 Author Posted October 20, 2014 yep thats right its not the correct path as the images are not uploaded could u join my site and guide me as iv been trying to fix this since yesterday Quote
G7470 Posted October 20, 2014 Posted October 20, 2014 An account will not necessarily help with much (if anything at all) in terms of this issue, but I have an account. However, PM me here if you need help. ~G7470 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.