jasonc Posted March 28, 2010 Share Posted March 28, 2010 i am unable to get the image to show the same using CSS like it shows using the standard <img src="images/myimg.gif" height="9" width="9" alt="the alt"> i am trying this but i get what i can only say looks like a broken image icon over the image that is shown. img#myimg { background-image:url("images/myimg.gif"); background-repeat: no-repeat; line-height: 9px; } <img id="myimg" alt="the alt"> what would be the correct way to do this. Quote Link to comment https://forums.phpfreaks.com/topic/196777-unable-to-get-image-to-show-same-using-css-like-it-shows-using-standard/ Share on other sites More sharing options...
zeodragonzord Posted March 28, 2010 Share Posted March 28, 2010 I was able to get that to work. I think perhaps the image path is incorrect. Also, set the height and width attributes to your CSS style to match the image. See if that helps. If not, fully quality your image path so you can take that off the equation just for testing. Change it back to a local path when done testing. Fully qualify: http:www.example.com/images/myimg.gif Quote Link to comment https://forums.phpfreaks.com/topic/196777-unable-to-get-image-to-show-same-using-css-like-it-shows-using-standard/#findComment-1033140 Share on other sites More sharing options...
haku Posted March 29, 2010 Share Posted March 29, 2010 CSS paths are relative to the CSS document, not the HTML document. So if you are using the same path as you were in your HTML document, it's not going to work. Quote Link to comment https://forums.phpfreaks.com/topic/196777-unable-to-get-image-to-show-same-using-css-like-it-shows-using-standard/#findComment-1033297 Share on other sites More sharing options...
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.