为header的背景图片添加链接

一般我们在日志中的标题都会带一两张图片,下面提供一个为日志header.php中的背景图片添加上链接的简单方法:

如果你在header.php中是这样定义背景图片的:

<div class=”headerbg”></div>

然后在style.css中定义图片路径如下:

.headerbg{ background: url(images/bg.gif); }

要让bg.gif这背景图片添加指定的链接,我们只需把上面的第一句代码改为如下即可:

<a href=”http://www.yoursite.com/”>
<div class=”headerbg”></div>
</a>

上面介绍的方法很简单。但它可能让你的网页通过不了xhtml的认证。所以,使用与否,大家自己看啦。

分类:WordPress;标签:, ;收藏本文的永久链接

2 Responses to “为header的背景图片添加链接”

  1. Greanty 回复此留言 2007/10/18 07:43 #comment-1738

    hehe~~leave space for font h1 (like padding:0 100px 50px 0), and make font size smaller ~0px? then you'll get the link....


The trackbacks and pingpacks: