首页 > 解决方案 > 如何在视觉代码中使用图像它不起作用?

问题描述

在此处输入图像描述 使用图像标签的浏览器中未显示图像我错在哪里? 我想在 Web 中添加图像,但我无法在可视代码中使用它我不知道要在图像的 URL 中从哪里添加图像,所以任何人都可以指导。

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Sign up </title>
</head>
<body>
  <div class="Header">
      <a href="/" class="LogoWrapper" >
      <img src="D:\my-angular-projects\signup-form\src\image\Snap.jpg" alt="Scone O'Clock logo" />
      </a>
      <p class="Strap">Scones: the most resplendent of snacks </p>
   </div>

        <div class="IntroWrapper">
            <p class="IntroText">
              Occasionally maligned and misunderstood; the scone is a quintessentially British classic.
            </p>
         <div class="MoneyShot">
              <img class="MoneyShotImg" src="D:\my-angular-projects\signup-form\src\image\1555932407.jpg" alt="Incredible scones" />
              <p class="ImageCaption">Incredible scones, picture from Wikipedia</p>
         </div>
       </div>
     <p>Recipe and serving suggestions follow.</p>
   <div class="Ingredients">
      <h3 class="SubHeader">
      Ingredients</h3>
      <ul>
     </ul>
    </div>
   <div class="HowToMake">
    <h3 class="SubHeader">Method</h3>
    <ol class="MethodWrapper">
    </ol>
   </div>
</body>

   

 </html>

标签: htmlcssimageurl

解决方案


问题是您的文件根据 html 文件的位置检索图像,并且它不会检查整个计算机硬盘驱动器。

因此,如果您想解决问题,基本上可以从 html 文件位置开始。因此,如果您的 html 文件位于 src 文件夹中,则您的 img 标签应为

<img src="image/1555932407.jpg">

否则,如果您在注册表格文件夹中有您的 html 文件,我将使用它

<img src="src/image/1555932407.jpg">

希望你发现这很有用,否则只需评论这篇文章。


推荐阅读