【问题标题】:Changing location of the image using '<img src>'使用“<img src>”更改图像的位置
【发布时间】:2020-12-04 00:15:34
【问题描述】:

我正在使用以下命令将 png 图像放入我的 html 页面。

print count_out '<img src="./mydata.png">';

我还在我的 html 页面上写了一个表格。问题是这张图片出现在顶部,然后下面是表格。 我需要顶部的表格,然后是下面的图像。

下面是我打印表格的部分:

print count_out "<HTML>";
print count_out "<head>";
print count_out "</head>";
print count_out "<table border='1' cellpadding='10' cellspacing='0' width='50%' height='1%'>";
while (<F>) {
    chomp;
    my @list = split(/,/);
    my $design = $list[0];
    my $bto_date = $list[1];
    my $die_size = $list[2];
    my $technology = $list[3];
    my $transistor_count = $list[4];

print count_out "<tr>";
print count_out "<TD padding-left: 10pxpadding-right: 10pxwidth='90px'bgcolor='#FFFFFF'><font size='2'>$design</TD>";
print count_out "<TD padding-left: 10pxpadding-right: 10pxwidth='90px'bgcolor='#FFFFFF'><font size='2'>$bto_date</TD>";
print count_out "<TD padding-left: 10pxpadding-right: 10pxwidth='90px'bgcolor='#FFFFFF'><font size='2'>$die_size</TD>";
print count_out "<TD padding-left: 10pxpadding-right: 10pxwidth='90px'bgcolor='#FFFFFF'><font size='2'>$technology</TD>";
print count_out "<TD padding-left: 10pxpadding-right: 10pxwidth='90px'bgcolor='#FFFFFF'><font size='2'>$transistor_count</TD>";
print count_out "</tr>";

【问题讨论】:

  • 没有&lt;/table&gt; 打印,即表永远不会关闭。这可能解释了为什么图像的位置被弄乱了——尽管您没有显示与 img 相关的打印语句在代码中的确切位置。

标签: html perl


【解决方案1】:

你没有关闭标签。

print count_out "</table>";

至少丢失了。

【讨论】:

    【解决方案2】:

    谢谢 添加以下行对我有用

    print count_out "</table>";
    

    当我打开 html 时..我看到表格但图像没有显示..我点击刷新 8-10 次..然后它显示..为什么会这样

    【讨论】:

    • 取决于您的浏览器,这可能只是缓存。尝试清除浏览器缓存,然后运行脚本。
    • 这不是答案,而是错过了问题。
    猜你喜欢
    • 2016-02-13
    • 2010-11-26
    • 1970-01-01
    • 2013-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-25
    • 2015-12-14
    相关资源
    最近更新 更多