【发布时间】:2022-12-04 02:02:55
【问题描述】:
对于 HTML 代码的几个不同部分,我尝试包含图像和图形,图像和图形都在 VS 代码中与它们所引用的 HTML 页面相同的文件夹中,但它们显示为损坏的图像,并且404 未找到错误(图表是一个 html 文件)
我将这段代码用于 PNG 文件,我尝试了显式文件路径和相对文件路径的每种组合,只是 bastian.png,但它们都会导致图像损坏。
<footer class="mb-5 small text-center text-muted">
Data provided by <a href="https://www.bastiansolutions.com/"></a>
<img src="final_project/templates/bastian.png" alt="Bastian Solutions logo">
</footer>
对于 HTML 文件,我尝试了相同的不同文件路径但没有结果,这是代码:
{% extends "layout.html" %}
{% block title %}
Capacity Chart
{% endblock %}
{% block main %}
<h1>Quoted</h1>
<h3>Width: {{ width }}
Length: {{ length }}
Type: {{ type }}</h3>
<div>
<iframe src="final_project/templates/test_graph.html" height="800" width="1200" frameBorder="0"></iframe>
</div>
{% endblock %}
【问题讨论】:
-
你是说 img 与 html 页面在同一个文件夹中,如果是这样,“final_project/templates/bastian.png”应该是“bastian.png”,不是吗?