Html 如何在登录页面中添加.png文件

Html 如何在登录页面中添加.png文件,html,css,Html,Css,我需要一些帮助上面的代码,因为我想显示在我的html格式的图像,所以如果有人可以建议一些东西,请。图像不会显示,而是显示其替代文本,即“用户图标”始终出现您在图像src中给出了错误的图像地址 <form action="index.php" method="POST"> <img src="C:\xampp\htdocs\Online_Examination_System\images\User_Icon.png" id="icon" alt="User Icon"

我需要一些帮助上面的代码,因为我想显示在我的html格式的图像,所以如果有人可以建议一些东西,请。图像不会显示,而是显示其替代文本,即“用户图标”始终出现

您在图像src中给出了错误的图像地址

<form action="index.php" method="POST">
      <img src="C:\xampp\htdocs\Online_Examination_System\images\User_Icon.png" id="icon" alt="User Icon" />  
      <input type="text" id="login" class="fadeIn second" name="uname" placeholder="login">
      <input type="password" id="password" class="fadeIn third" name="pass" placeholder="password">
      <input type="submit" class="fadeIn fourth" value="Log In" name="subt">
    </form>


注意:您的图像必须位于images文件夹中。

您必须使用“/”而不是“\”。
您的路径应该是:“./images/User_Icon.png”

您的文件路径错误,它显示了您的备用文本

试试看:

<form action="index.php" method="POST">
  <img src="./images/User_Icon.png" id="icon" alt="User Icon" />  
  <input type="text" id="login" class="fadeIn second" name="uname" placeholder="login">
  <input type="password" id="password" class="fadeIn third" name="pass" placeholder="password">
  <input type="submit" class="fadeIn fourth" value="Log In" name="subt">
</form>

确保您的用户_Icon.png位于“图像”文件夹中!
祝你好运。

没有。它应该是
/images/User_Icon.png
或类似的格式谢谢!!非常感谢您的努力。您能看到控制台上的一些错误吗?你确定名字和目录是正确的吗?你能接受这个答案吗?如果它对你有用?
<img src="./images/User_Icon.png" id="icon" alt="User Icon" />