【问题标题】:Image is not showing up on my webpage图片未显示在我的网页上
【发布时间】:2018-04-10 19:10:14
【问题描述】:

图像标签不起作用。不确定我是否遗漏了某些内容,或者我错误地添加了图像标签。图片在同一个文件夹中,所以插入图片没有问题。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="description" content="type the content description here" />
    <meta name="keywords" content="type, keywords, here" />
    <link rel="stylesheet" href="text.css" type="text/css" />
    <style type="text/css">
    h1.align1 { text-align: center; }
    h2.align2 { text-align: center; }
    h3.align3 { text-align: center; }
    </style> 
</head>
<body style="background-color: black;"> 
    <h1 class="align1" style="color: yellow;"><font size="8"> TEXT </h1>
    <hr style="white" />
    <h2 class="align2" style="color: red;"><font size="10"> TEXT </h2>
    <hr style="white" />
    <h3 class="align3" style="color: blue;"><font size="10"> TEXT </h3> 
    <img src="years1.jpg" />
</body>
</html>

【问题讨论】:

  • 你能告诉我们你的文件夹结构吗
  • HTML 代码不够,我们需要证明图片存在于目录中
  • 你有很多语法问题,不能关闭标签,使用错误的方式等你应该修改一些 HTML 基础
  • 在您的浏览器(非 IE)中使用“检查元素”来调试图像应该在的位置。在检查器的“网络”选项卡中,您可以看到图像是否也可以为浏览器加载。

标签: html css


【解决方案1】:

你必须关闭你的字体标签(未完成的标签可能会影响后面的元素,在本例中是“图像”)。

例如:

<h1 class="align1" style="color: yellow;"><font size="8"> TEXT </font></h1>

font 标签在 HTML5 中是 deprecated 过时的,所以你应该这样写:

<h1 class="align1" style="color: yellow; font-size: 8em; "> TEXT </h1>

【讨论】:

【解决方案2】:

这是一个 img 路径问题。请为图像使用合适的文件路径, 并删除字体标签并在样式下使用它。

【讨论】:

    猜你喜欢
    • 2021-01-30
    • 1970-01-01
    • 2017-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多