我希望我的按钮具有不同于页面背景的固定封面背景

时间:2015-07-20 21:58:05

标签: html css

我有以下网页:http://jsfiddle.net/Leytgm3L/16/

正如您所看到的,我有CSS代码描述按钮:

.learn-btn, .download-btn {
    display: inline-block;
    padding: 18px 46px;
    border: 2px solid #fff;
    border-radius: 3px;
    color: #fff;
    font-size: 16px;
}

多亏了这一点 - 它是透明的。我希望它与上面的div具有相同的背景:

#black{
    background: url('http://www.geeknaut.com/images/windows-wallpapers/Cool-Windows-7-Wallpapers.jpg') no-repeat center center fixed;  
    background-size: cover;
}

而不是我网页的背景:

.hero4{
background:url('http://i.imgur.com/D2ATnw8.jpg') no-repeat center center;
}

我该如何制作,所以按钮不仅具有上面div的背景,而且这个背景是固定的并且被覆盖了?

1 个答案:

答案 0 :(得分:1)

我将图片添加到按钮http://jsfiddle.net/Leytgm3L/17/的背景中,如下所示:

#black{
    background: url('http://www.geeknaut.com/images/windows-wallpapers/Cool-Windows-7-Wallpapers.jpg') no-repeat center center fixed;  
    background-size: cover;
}