代码:
<div class="about-img">
<img src="https://ella.sice.indiana.edu/~macnaust/headshot.jpg" class="img-fluid rounded b-
shadow-a" alt="image not found">
</div>
当我在浏览器中将其作为文件打开时,我看到的图像很好。但是当我导航到已发布的网页时,它丢失了,并且替代文本也不显示。
我做错了什么?
代码:
<div class="about-img">
<img src="https://ella.sice.indiana.edu/~macnaust/headshot.jpg" class="img-fluid rounded b-
shadow-a" alt="image not found">
</div>
当我在浏览器中将其作为文件打开时,我看到的图像很好。但是当我导航到已发布的网页时,它丢失了,并且替代文本也不显示。
我做错了什么?
试试这个:将您的代码更改为以下内容:如果它有效,则在相对与绝对文件夹路径上搜索。
<div class="about-img">
<img src="/macnaust/headshot.jpg" class="img-fluid rounded b-
shadow-a" alt="image not found">
</div>
尝试删除波浪号并重新开始。实际上波浪号'~'代表主目录。当您在 url 中放置波浪号时,它将从主目录访问。所以,把图片放在 macnaust/DevFolio/assets/img/ 文件夹然后把 src 改成
<img src="https://ella.sice.indiana.edu/macnaust/headshot.jpg" class="img-fluid