简体   繁体   English

在表格单元格HTML内添加图像时出错

[英]Error adding image inside table cell HTML

My image's link reference is break. 我图像的链接参考是中断。 But the image and the html file are in the same folder. 但是图像和html文件位于同一文件夹中。 And I think that this code is correct: 而且我认为这段代码是正确的:

<td><img src="test.jpg" alt="" border=3 height=100 width=300></img></th>

This error occurs when I try to run my web application using eclipse, but I created a simple html file in the desktop and put the image there too, then it runs perfectly. 当我尝试使用Eclipse运行Web应用程序时发生此错误,但是我在桌面上创建了一个简单的html文件并将图像也放置在其中,然后它可以完美运行。 Both codes are the same. 这两个代码是相同的。

Code: 码:

{{define "content"}}

<table>
    <tr>
        <td>Jill</td>
        <td>Smith</td>
        <td><img src="test.jpg" alt="" border=3 height=100 width=300 /></td>
    </tr>
    <tr>
        <td>Eve</td>
        <td>Jackson</td>
        <td>94</td>
    </tr>
</table>

{{end}} {{结束}}

You have a few issues with your code. 您的代码有一些问题。 You have tags open, but using the wrong closing tag. 您有打开的标签,但使用了错误的结束标签。 Try this: 尝试这个:

<td><img src="test.jpg" alt="" border=3 height=100 width=300 /></td>

Also, it seems you are using HTML4 - very old. 另外,看来您使用的是HTML4-非常旧。 Once you have it working, I suggest removing the border, height and width attributes and use CSS instead. 一旦工作,我建议删除border,height和width属性,并改用CSS。

As you are adding that by saving normal HTML file from desktop, it will work. 通过从桌面保存普通的HTML文件来添加它时,它将起作用。 But in other case, Code has to be as per its standard rule. 但是在其他情况下,代码必须遵循其标准规则。 And you were missing some. 而你却错过了一些。 Please see below the correct way: 请按照以下正确方法查看:

<td>
   <img src="test.jpg" alt="" border=3 height=100 width=300 />
</td>

Also let us know if there is any path related issues. 还请让我们知道是否存在任何与路径有关的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM