目前,我正在尝试将.wrap-artist
中的内容显示在背景图像上方,并显示模糊。
CSS
.wrap-artwork {
left: 0;
right: 0;
z-index: 1;
display: block;
background-image: url('https://i1.sndcdn.com/artworks-000183268921-teibnr-t500x500.jpg');
background-size: cover;
background-position:center;
height: 150px;
margin-bottom: 20px;
margin-top: -1px;
margin-right: -16px;
margin-left: -16px;
-webkit-filter: blur(8px);
-moz-filter: blur(8px);
-o-filter: blur(8px);
-ms-filter: blur(8px);
filter: blur(8px);
}
.wrap-artist {
position: relative;
left: 0;
right: 0;
z-index: 9999;
margin-left: 20px;
margin-right: 20px;
}
.container {
margin-top: 25px;
max-width: 100%;
margin-left: auto;
margin-right: auto;
background-color: #ffffff;
border: 1px solid #ddd;
width: 1080px;
overflow: hidden;
padding-bottom: 25px;
}
我已经尝试过搞乱这些职位但是我使用它的结构似乎根本不起作用。
HTML
<div class="container">
<div class="wrap-artwork"></div>
<div class="wrap-artist">
this is our image content
</div>
<div class="col-md-8">
some other content here
</div>
<div class="col-md-4">
finally some sidebar content here
</div>
</div>
希望有人可以帮助我,我使用this question来指导我,但在第一个答案中一定要错过了解。
.wrap-artwork {
left: 0;
right: 0;
z-index: 1;
display: block;
background-image: url('https://i1.sndcdn.com/artworks-000183268921-teibnr-t500x500.jpg');
background-size: cover;
background-position:center;
height: 150px;
margin-bottom: 20px;
margin-top: -1px;
margin-right: -16px;
margin-left: -16px;
-webkit-filter: blur(8px);
-moz-filter: blur(8px);
-o-filter: blur(8px);
-ms-filter: blur(8px);
filter: blur(8px);
}
.wrap-artist {
position: relative;
left: 0;
right: 0;
z-index: 9999;
margin-left: 20px;
margin-right: 20px;
}
.container {
margin-top: 25px;
max-width: 100%;
margin-left: auto;
margin-right: auto;
background-color: #ffffff;
border: 1px solid #ddd;
width: 1080px;
overflow: hidden;
padding-bottom: 25px;
}
<div class="container">
<div class="wrap-artwork"></div>
<div class="wrap-artist">
this is our image content
</div>
<div class="col-md-8">
some other content here
</div>
<div class="col-md-4">
finally some sidebar content here
</div>
</div>
答案 0 :(得分:0)
你想要那样的东西吗? :See this fiddle
如果是这样,您必须将relative
位置添加到.container
父级,并将relative
位置替换为absolute
top
.wrap-artist
属性.wrap-artist {
position: absolute;
top: 0;
left: 0;
right: 0;
z-index: 9999;
margin-left: 20px;
margin-right: 20px;
}
.container {
margin-top: 25px;
max-width: 100%;
margin-left: auto;
margin-right: auto;
background-color: #ffffff;
border: 1px solid #ddd;
width: 1080px;
overflow: hidden;
padding-bottom: 25px;
position: relative;
}
}类。
Workflow jetbrains-youtrack-scrum reports error: Cannot find State [Done]
Contact project admin admin
答案 1 :(得分:0)
.wrap-artwork {
left: 0;
right: 0;
z-index: 1;
display: block;
background-image: url('https://i1.sndcdn.com/artworks-000183268921-teibnr-t500x500.jpg');
background-size: cover;
background-position:center;
height: 150px;
margin-bottom: 20px;
margin-top: -1px;
margin-right: -16px;
margin-left: -16px;
-webkit-filter: blur(8px);
-moz-filter: blur(8px);
-o-filter: blur(8px);
-ms-filter: blur(8px);
filter: blur(8px);
}
.wrap-artist {
position: absolute;
color: white;
font-size: 19px;
font-weight: bold;
top: 160px;
left: 0;
right: 0;
z-index: 9999;
margin-left: 20px;
margin-right: 20px;
}
.container {
margin-top: 25px;
max-width: 100%;
margin-left: auto;
margin-right: auto;
background-color: #ffffff;
border: 1px solid #ddd;
width: 1080px;
overflow: hidden;
padding-bottom: 25px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="container">
<div class="row">
<div class="wrap-artwork col-md-12">
</div>
<div class="wrap-artist">
this is our image content
</div>
</div>
<div class="row">
<div class="col-md-8">
some other content here
</div>
<div class="col-md-4">
finally some sidebar content here
</div>
</div>
</div>