图像将在vs代码中显示在HTML扩展中的图像

发布于 2025-01-30 11:00:06 字数 904 浏览 5 评论 0原文

我有此代码:

<!DOCTYPE html>
<html>
    <head>
        <h1 title="First Heading">Heading 1</h1>
        <h6 title="Second Heading">Heading 2</h6>
    </head>
    <body>
        <p title="First Paragraph">Paragraph 1</p>
        <p title="Second Paragraph">Paragraph 2</p>
        <a href="https://www.w3schools.com/html/html_basic.asp" >W3schools</a>
        <img src="C:\Users\yorda\OneDrive\Gambar\Aseprite\.jpeg\Canyon.jpeg" alt="Pixel Art" width="320" height="180"
    </body>
</html>

如果我通过File Explorer打开HTML文件(双击它并转到Chrome),它将显示图像。

”“”

但是如果我想通过VS代码扩展来预览我的html文件,则映像不会显示出来。

“”

为什么会发生这种情况?有什么方法可以解决这个问题? 提前致谢。

I have this code:

<!DOCTYPE html>
<html>
    <head>
        <h1 title="First Heading">Heading 1</h1>
        <h6 title="Second Heading">Heading 2</h6>
    </head>
    <body>
        <p title="First Paragraph">Paragraph 1</p>
        <p title="Second Paragraph">Paragraph 2</p>
        <a href="https://www.w3schools.com/html/html_basic.asp" >W3schools</a>
        <img src="C:\Users\yorda\OneDrive\Gambar\Aseprite\.jpeg\Canyon.jpeg" alt="Pixel Art" width="320" height="180"
    </body>
</html>

If I open my html file via file explorer (double clicking it and go to chrome) it will show the image.

but if I want to preview my html file via VS Code extension the image wont show up.

why is this happen? any way to solve this?
Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

以往的大感动 2025-02-06 11:00:06

您必须将图像放在index.html文件的同一位置。

然后将您的IMG SRC修改为

<img src="Canyon.jpeg" />

You have to put the image in the same location of your index.html file.

then modify your img src to

<img src="Canyon.jpeg" />
水水月牙 2025-02-06 11:00:06

我想我在其他地方读到一个扩展名不受欢迎。它称为HTML预览。找出您是否正在使用的那个。我使用它,也有同样的问题,但我还没有解决。

I think i read somewhere else that one extension is not supported well. It's called Html Preview. Find out if it is the one you're using. I use it and i have the same issue but i'm yet to solve it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文