HTML显示损坏的图像 [英] HTML showing broken image
本文介绍了HTML显示损坏的图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下html代码,当我在浏览器中将其拉起时,图像要么不显示,要么图像损坏:
i have the following html code and when i pull it up in my browsers the image either doesnt show up, or it shows a broken image:
<!DOCTYPE html>
<html>
<head>
<title>Lets Play Battleship</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>
Battleship
<p><img src="battleship-game-board.jpg" width = "120" height = "90"/></p>
</h1>
<p><a href="http://www.freeonlinegames.com/game/battleships"> Click Here to Play Battleship</a></p>
</body>
</html>
推荐答案
要使图像正常工作,请使用:
To make image work either you use:
绝对路径:
<img src="http://www.domain.com/MyImages/battleship-game-board.jpg"/>
或
相对路径:
<img src="../MyImages/battleship-game-board.jpg"/>
如果图像存在于同一文件夹中,则html文件存在,那么您可以使用:
if image exist in same folder the html file exist then you can use:
<img src="battleship-game-board.jpg" width = "120" height = "90"/>
更多详细信息此处
注意:在所有情况下,图像都必须存在于给定的路径中.
Note: image must exist in given path in all cases.
这篇关于HTML显示损坏的图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文