【问题标题】:Cannot insert an image into HTML document无法将图像插入 HTML 文档
【发布时间】:2014-12-10 10:24:30
【问题描述】:

我知道这是一个非常基本的问题,但它让我发疯。

我正在尝试在我正在处理的 HTML 文档中插入图像(“logo_footer.png”)。这是一个 Python 网络应用程序,我使用的是 TurboGears 2 框架。

我尝试了几种不同的方法,但没有一个对我有用:

方法一:

.logo-footer { border: 1px solid green;
                height:140px; width:600px;
                background:transparent url('{{url2(tg.url("/images/atenea/logo_footer.png"))}}');
                background-position:right center !important;
                background-repeat:no-repeat;
                background-size:contain;
                float:left;
}

方法二:

<div class="pie">
    <div class="logo-footer">
        <img height="120" src="{{tg.url('/images/atenea/logo_footer.png')}}">
    </div>
    <div class="firma-footer">
        <div class="dato-empresa">Blabla</div>
    </div>
</div>

当然,图像存在。我在这里错过了一些非常基本和明显的东西吗?

为什么我什至不能使用&lt;img&gt; 标签使图像出现?

更新

最后,问题出在wkhtmltopdf 库上,我使用它来将html 转换为PDF 文档。无论出于何种原因,我仍然不知道,该图像出现在我的文档的 html 版本中,但它没有出现在 wkhtmltopdf 生成的 PDF 版本中。

【问题讨论】:

    标签: html css turbogears2


    【解决方案1】:
    <img height="120" src="images/atenea/logo_footer.png" />
    

    假设它们在 images 文件夹中,然后尝试 css 中当前脚本中的ateneaa 文件夹

    background:transparent url("/images/atenea/logo_footer.png");
    

    去掉卷发

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-02
      • 1970-01-01
      • 2021-04-27
      • 1970-01-01
      • 1970-01-01
      • 2011-07-11
      相关资源
      最近更新 更多