【问题标题】:After Uploading html files its broken images上传 html 文件后,其损坏的图像
【发布时间】:2019-03-09 04:07:53
【问题描述】:

我制作了一个运行良好的 html 文件,但是在将其上传到一些免费的域名主机后,一些图像没有加载。 This 是网站,this 是它的样子

<!doctype html>
<html>
<body id="grad1">
<link rel="stylesheet" type="text/css" href="stylenav.css">
<div class="nav" align="right"><font size="4%"><!--NAV BAR-->
    <nav>
            <font size="3%"><a href="main.html" title="Home" class="navb" target="bottom" id="navb1"><b><img src="icons/home.png" height="30%" width="30%" class="invert"></b></a></font>
            <font size="3%"><a href="about.html" class="navb" target="bottom" id="navb2"><b><img src="icons/about.png" height="30%" width="30%" title="About" class="invert"></b></a></font>
            <font size="3%"><a href="gallery.html" class="navb" target="bottom" id="navb3"><b><img src="icons/gallery.png" height="30%" width="30%" title="Gallery" class="invert"></b></a></font>
            <font size="3%"><a href="favorites.html" class="navb" target="bottom" id="navb4"><b><img src="icons/favorites.png" height="30%" width="30%" title="Favorites" class="invert"></b></a></font>
            <font size="3%"><a href="hobbies.html" class="navb" target="bottom" id="navb5"><b><img src="icons/hobbies.svg" height="30%" width="30%" title="Hobbies" class="invert"></b></a></font>
        </font>
    </nav>
        <div align="left" style="margin-top: -5%; color: #eb4979;">
            <img src="images/logo.png" height="40%">
            <font size="10%"><b><span style=" position: absolute; margin-top: 10; text-shadow: 0 0 3px rgba(0, 0, 0, .8)">Dexter Silva</span></b></font>
        </div>
    </div>
</body>
</html>

【问题讨论】:

  • 你没有上传图片或者图片src是worg
  • 我上传了图片。 wdym 通过图像 src?它的位置正确
  • 你能把你的代码贴出来,让我们看看哪里出了问题
  • 它是一个大文件,所以我放了其中一个损坏的代码
  • Infinityfree 免费套餐有这种问题。曾经我将它用于学校项目并且遇到了很多困难,尤其是从 GSM 模块发送数据到托管页面。使用 Heroku。

标签: html css web error-handling


【解决方案1】:

请检查您的所有文件是否已上传...例如我找不到

<img src="images/logo.png" height="40%">

images/logo.png 在您的服务器上。

icons/favorites.png 也应该在 images/icons/favorites.png 中 所以它找不到图片。

有些服务器区分大小写,因此请确保您的 html 能够找到它

顺便说一句,做得很好,继续努力 提示:您的菜单按钮打开新页面。更好地在同一页面中显示您的内容 尝试类似https://www.w3schools.com/howto/howto_js_curtain_menu.asp

【讨论】:

  • 谢谢,我要试试,顺便说一句,我的老师不会让我们使用 jquery 和 css,但我坚持使用 css,因为没有 css 的 html 看起来很恶心。
【解决方案2】:

您的图片位于嵌套文件夹中,请添加images/ 到链接到正确文件夹的路径: src="images/icons/favorites.png" 代替 src="icons/favorites.png"

【讨论】:

  • 我已经这样做了,因为我是从 html 从头开始​​制作的
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2020-04-15
  • 1970-01-01
  • 1970-01-01
  • 2022-01-03
  • 2017-08-29
  • 2012-07-19
  • 1970-01-01
相关资源
最近更新 更多