gpt4 book ai didi

html - Flexbox box-shadow webkit

转载 作者:行者123 更新时间:2023-12-04 01:51:35 24 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





css3 drop shadow under another div, z-index not working [duplicate]

(3 个回答)


5年前关闭。




我试图在我的导航栏上添加 box-shadow ,似乎内容掩盖了它。

.value,
.icon,
.text,
.date {
display: inline-flex;
height: 50px;
}

.current {
display: flex;
justify-content: center;
align-content: center;
height: 50px;
background: grey;
box-shadow: 0 2px 3px #000;
/* z-index doesn't help here */
z-index: 9999;
}

.current h1 {
margin: 5px 0;
color: #eee;
font-family: "Roboto", sans-serif;
}

.items {
min-height: 50px;
display: flex;
flex-direction: column;
}

.item {
height: 50px;
background: #eee;
border-bottom: 1px solid #aaa;
display: flex;
}

.icon {
width: 30px;
min-width: 30px;
justify-content: center;

}

.up {
background: #F1F8E9;
}

.down {
background: #FFEBEE;
}

.up > .icon {
background: #8BC34A;
}

.down > .icon {
background: #F44336;
}

.icon > span {
font-size: 20px;
height: 20px;
align-self: center;
color: #fff;
}

.value > span {
align-self: center;
font: 700 24px/24px "Roboto", sans-serif;
padding: 0 15px;
}

.up > .value > span {
color: #8BC34A;
}

.down > .value > span {
color: #F44336;
}

.text {
height: 50px;
}

.date {
margin-left: auto;
}

.text > span {
font: 500 16px/16px "Roboto", sans-serif;
padding: 10px 0 0 5px;
}

.date > span {
display: flex;
font: 600 12px/12px "Roboto", sans-serif;
padding: 0 5px 5px 0;
height: 15px;
align-self: flex-end;
}
<div id="current" class="current">
<h1 id="pocket">Box-shadow</h1>
</div>
<div id="items" class="items">
<div class="item up">
<div class="icon">
<span class="fa fa-arrow-up" aria-hidden="true"></span>
</div>
<div class="value">
<span>250</span>
</div>
<div class="text">
<span>First message</span>
</div>
<div class="date">
<span>20.09.2016</span>
</div>
</div>
<div class="item down">
<div class="icon">
<span class="fa fa-arrow-down" aria-hidden="true"></span>
</div>
<div class="value">
<span>250</span>
</div>
<div class="text">
<span>Second message</span>
</div>
<div class="date">
<span>20.09.2016</span>
</div>
</div>
</div>


我也试过 z-index我的属性(property) .current元素,但它没有帮助。我的代码有错误还是应该使用某个属性?

最佳答案

对于 z-index工作需要定位,所以添加position: relative;给您的 .current

.value,
.icon,
.text,
.date {
display: inline-flex;
height: 50px;
}

.current {
display: flex;
justify-content: center;
align-content: center;
height: 50px;
background: grey;
box-shadow: 0 4px 6px #000;
z-index: 2;
position: relative;
}

.current h1 {
margin: 5px 0;
color: #eee;
font-family: "Roboto", sans-serif;
}

.items {
min-height: 50px;
display: flex;
flex-direction: column;
}

.item {
height: 50px;
background: #eee;
border-bottom: 1px solid #aaa;
display: flex;
}

.icon {
width: 30px;
min-width: 30px;
justify-content: center;

}

.up {
background: #F1F8E9;
}

.down {
background: #FFEBEE;
}

.up > .icon {
background: #8BC34A;
}

.down > .icon {
background: #F44336;
}

.icon > span {
font-size: 20px;
height: 20px;
align-self: center;
color: #fff;
}

.value > span {
align-self: center;
font: 700 24px/24px "Roboto", sans-serif;
padding: 0 15px;
}

.up > .value > span {
color: #8BC34A;
}

.down > .value > span {
color: #F44336;
}

.text {
height: 50px;
}

.date {
margin-left: auto;
}

.text > span {
font: 500 16px/16px "Roboto", sans-serif;
padding: 10px 0 0 5px;
}

.date > span {
display: flex;
font: 600 12px/12px "Roboto", sans-serif;
padding: 0 5px 5px 0;
height: 15px;
align-self: flex-end;
}
<div id="current" class="current">
<h1 id="pocket">Box-shadow</h1>
</div>
<div id="items" class="items">
<div class="item up">
<div class="icon">
<span class="fa fa-arrow-up" aria-hidden="true"></span>
</div>
<div class="value">
<span>250</span>
</div>
<div class="text">
<span>First message</span>
</div>
<div class="date">
<span>20.09.2016</span>
</div>
</div>
<div class="item down">
<div class="icon">
<span class="fa fa-arrow-down" aria-hidden="true"></span>
</div>
<div class="value">
<span>250</span>
</div>
<div class="text">
<span>Second message</span>
</div>
<div class="date">
<span>20.09.2016</span>
</div>
</div>
</div>

关于html - Flexbox box-shadow webkit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39582644/

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