我的新博客标题图像没有显示…如何正确地编写代码


My new blog header image is not displaying... How to I correctly write the code?

据我所知,我可能需要修改header.php文件以及style.css文件。我已经将图像上传到托管网站,我相信这是一个相对链接:(/public_html/wp-content/themes/sandbox/Header-1.jpg)

。这是我的style.css代码:

#header { border-bottom:none;
    height:200px;
    padding-top:0;
    padding-bottom:0;
    background:url("/public_html/wp-content/themes/kid/Header-1.jpg")
    no-repeat bottom center; }

#headerimg  {
      height: 200px; 
      width: 800px; }

这是header。php

中的原始php
<div id="header">
        <h1 id="blog-title"><span><a href="<?php bloginfo('home') ?>/" title="<?php echo wp_specialchars( get_bloginfo('name'), 1 ) ?>" rel="home"><?php bloginfo('name') ?></a></span></h1>
        <div id="blog-description"><?php bloginfo('description') ?></div>
    </div><!--  #header -->

我已经尝试用

替换h1 id和div id行
<img src= "/public_html/wp-content/themes/sandbox/Header-1.jpg"/>

但是没有效果。

现在网站没有标题,可以在这里看到:www.dearjasmina.com

谢谢你的时间!

您使用的路径不正确。应该是/wp-content/themes/sandbox/Header-1.jpg

所以你的css应该是
#header {
    height:200px;
    padding-top: 0;
    padding-bottom: 0;
    background:url('/wp-content/themes/kid/Header-1.jpg') no-repeat bottom center;
}

Try

#header { border-bottom:none;
    height:200px;
    padding-top:0;
    padding-bottom:0;
    background:url("/wp-content/themes/kid/Header-1.jpg")
    no-repeat bottom center; }

#headerimg  {
      height: 200px; 
      width: 800px; }

你的背景实际上是http://www.dearjasmina.com/wp content/themes/sandbox/header - 1. - jpg

相对url似乎不正确。试着移除/public-html

删除图像路径中的public_html文件夹,使用如下
<img src="/wp-content/themes/sandbox/Header-1.jpg">

根据IE网络嗅探,您的图片上有404未找到。仔细检查你的url