在CSS背景图片中添加网址链接? [英] Add URL link in CSS Background Image?

查看:299
本文介绍了在CSS背景图片中添加网址链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个CSS条目,如下所示:

I have a CSS entry that looks like this:

.header {
    background-image: url("./images/embouchure.jpg");
    background-repeat: no-repeat;
    height:160px;
    padding-left:280px;
    padding-top:50px;
    width:470px;
    color: #eaeaea;
    border-bottom:1px solid #eaeaea;


}

如何将链接添加到该CSS中的背景图片?

How can I add the link to the the background image in that CSS?

可以找到完整的CSS 此处,使用的html是那里

The full CSS can be found here and the html that uses is there.

推荐答案

尝试将这些跨度包含在锚定标记中,并将背景图片应用于此。

Try wrapping the spans in an anchor tag and apply the background image to that.

HTML :

<div class="header">
    <a href="/">
        <span class="header-title">My gray sea design</span><br />
        <span class="header-title-two">A beautiful design</span>
    </a>
</div>

CSS:

.header {
    border-bottom:1px solid #eaeaea;
}

.header a {
    display: block;
    background-image: url("./images/embouchure.jpg");
    background-repeat: no-repeat;
    height:160px;
    padding-left:280px;
    padding-top:50px;
    width:470px;
    color: #eaeaea;
}

这篇关于在CSS背景图片中添加网址链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆