-1

我无法添加指向我的 CSS 背景的链接。我知道这是不可能的,但我想知道如何通过我的 html 添加它。这是我的CSS

`.home-featured.wall {
padding: 20px 0;
background: rgb(0, 0, 0) url(images/bg-pattern-black.png);
background-image: url(http://viralcentro.com/wp-content/uploads/2013/05/NBA-ad-Viral-Centro.png);
background-repeat: no-repeat;
background-position: center top;
position: relative;
text-shadow: none;
height: 730px;`

我的网站是http://viralcentro.com/ ,我试图添加链接的背景是篮球。

提前致谢。

4

2 回答 2

0

嗯,为什么不尝试将图像制作为本地图像并将其与服务器上的其他图像放在一个文件夹中。它可能无法正常工作,因为处理图像需要很长时间。当您链接到图像时,也可以尝试使用引号。

.home-featured.wall {
padding: 20px 0;
background: rgb(0, 0, 0) url('images/bg-pattern-black.png');
background-image: url('dir_imgs/NBA-ad-Viral-Centro.png'); /* replace dir_imgs with your     folder name*/
background-repeat: no-repeat;
background-position: center top;
position: relative;
text-shadow: none;
height: 730px;
于 2013-05-01T01:41:35.930 回答
0

我可以想到一种方法。这不是最好的方法,但它应该可以解决问题。就这样吧。

HTML:

<div id="backgroundpic">
        <img src="http://viralcentro.com/wp-content/uploads/2013/05/NBA-ad-Viral-Centro.png" onclick="redirect()" alt="something or other">
        </div>

Javascript:

<script>
            function redirect() {
                window.open(where_ever_you_want_it_to_go)
            }
        </script>

CSS:

# backgroundpic {
    height: 100%;
    width: 100%;
    position: absolute;
    z-index: 1;
}

如果您对 JavaScript 不太熟悉,那很好,但可能更容易。

于 2013-05-01T01:43:48.267 回答