Bootstrap - 重复图案覆盖与背景颜色jumbotron

时间:2017-04-05 05:00:56

标签: html css twitter-bootstrap

我试图在我的rebecca紫色背景颜色上为我的jumbotron获得重复的背景图像。我知道我做错了什么,只是不知道它是什么。这是代码:

.jumbotron {
background-color: rebeccapurple;
color: white;
width: auto;
height: 350px;
margin-bottom: 100px;
position: relative;
display: block;
font-family: FontAwesome;
}

.jumbotron::after {
content: '';
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: url(\images\bg_images\maze_white.png) repeat center center;
z-index: -1;
}

感谢所有帮助。谢谢。

2 个答案:

答案 0 :(得分:1)

由于z-index:-1,你的迷宫落后于jumbotron。你需要做的是交换周围的背景,就像这个小提琴http://jsbin.com/tekefobive/edit?css,output

.jumbotron {
background-image:url('pattern');
...
}
.jumbotron:after{
background:purple;
z-index:-1;
...
}

答案 1 :(得分:0)

< -130