gpt4 book ai didi

html - 如何重叠各种内容?

转载 作者:行者123 更新时间:2023-11-28 04:10:58 25 4
gpt4 key购买 nike

目前我正在努力使我来自 .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>

最佳答案

你想要这样的东西吗? : See this fiddle

如果是这样,您必须将 relative 位置添加到 .container parent 并将 relative 位置替换为 absolute.wrap-artist 类上使用 top 属性。

.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;
}

关于html - 如何重叠各种内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42714371/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com