【问题标题】:CSS image not showing WordpressCSS 图像未显示 Wordpress
【发布时间】:2012-07-05 22:07:30
【问题描述】:

我一直在尝试向 Wordpress 模板添加图像,当我添加标签时,它会自动添加 display: none;当它出现在网站上时。所以我决定将它添加为带有 div 的 css 图片。

我已将此添加到 CSS 中:

.myad a{
    background-image: url(http://www.henstagweekends.co.uk/images/advert.png);
    background-repeat: no-repeat;
    display: block;
    height: 248px;
    width: 189px;
    z-index: 100000;
}

我已将其添加到标签之前的 footer.php 中:

<div class="myad">
<a href="/jobs-with-epic-events"></a>
</div>

我添加了一个临时的背景颜色来显示它的位置。查看页面的最底部。 http://www.henstagweekends.co.uk/

知道是什么原因造成的吗?

【问题讨论】:

  • 当前展示的广告有问题吗?我觉得很好。

标签: html css wordpress templates


【解决方案1】:

url('URL') 指图片所在的路径。尝试将图像下载到您的文件夹并引用它:background-image: url('&lt;path&gt;/advert.png')

【讨论】:

  • 别忘了动态获取图片,&lt;?php get_bloginfo('template_directory'); ?&gt;
猜你喜欢
  • 1970-01-01
  • 2014-05-21
  • 2013-09-26
  • 2021-06-26
  • 1970-01-01
  • 1970-01-01
  • 2015-07-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多