简体   繁体   中英

Image tags display in Chrome but not in Firefox

I just set up my website on Namecheap, which I built in HTML and Twitter Bootstrap.

I am using the following tag for images

<img src="images\myimage.jpg">

This works fine in Chrome and in Firefox if I open it locally, but from my domain, the images don't show up in Firefox. It's still working fine in Chrome. I even tried this and got the same result:

<img src="file://localhost/images\myimage.jpg">

I just tried Fiddler2 and I get 404 messages that say under the url http://myurl.com/images%5Cmyimage.jpg

EDIT: I just figured it out my code was accident a "\\" instead of "/" which only affected firefox, thanks for all the help

<img src="images/myimage.jpg" alt="" />

/ instead of \\, also close the image tag and add the alt -attribute or your HTML will not validate.

Edit: Appearantly the /> is not mandatory, but the alt is...

This line of code is good

<img src="images/myimage.jpg">

you simply need to add a folder name images in the same folder where your html is stored. Make sure you got the file you are looking for in your images folder

edit : I just saw your new comment. Try adding an alt attribut to your image like this

<img src="images/myimage.jpg" alt="The image isn't showing"> 

At least you will know if the browser got the tag correctly

I figured it out I wrote it incorrectly in my original question but the "\\" should have been a "/". This only affected firefox

我也遇到了同样的问题,所以如果它在 chrome 中而不是在 Firefox 中显示图像,请在 chrome 中打开您的 Html 文件并右键单击图像并复制链接地址,使用 img src 中的相同链接地址。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM