gpt4 book ai didi

html - Box-Shadow 在其他元素上

转载 作者:太空宇宙 更新时间:2023-11-04 16:00:31 25 4
gpt4 key购买 nike

我有这个代码和icon <div> box-shadow结束icon-button我该如何解决?

* {
box-sizing: border-box;
}

.edit-button {
padding: 8px 12px;
width: 500px;
margin: 50px auto;
}

.icon-button {
position: relative;
background: #fcac22;
border-top: 1px solid #f9aa22;
border-right: none;
border-bottom: 3px solid #e29a1f;
border-left: 1px solid #f7a921;
color: #fff;
border-radius: 2px 0 0 3px;
outline: none;
text-align: center;
width: calc(100% - 36px);
height: 69px;
line-height: 18px;
padding: 19px;
text-shadow: 0px 0px .1px #fff;
z-index: 1;
-webkit-box-shadow: -1px 2px 19px 1px rgba(0, 0, 0, 0.3);
-moz-box-shadow: -1px 2px 19px 1px rgba(0, 0, 0, 0.3);
box-shadow: -1px 2px 19px 1px rgba(0, 0, 0, 0.3);
font-family: arial;
font-size: 16px;
font-weight: 400;
}
.icon-button .icon {
position: absolute;
width: 32px;
height: 69px;
display: inline-block;
right: -36px;
top: -1px;
background: #fcac22;
border-top: 1px solid #f9aa22;
border-right: 1px solid #f7a921;
border-bottom: 3px solid #e29a1f;
border-left: none;
border-radius: 0 2px 3px 0;
z-index: 0;
-webkit-box-shadow: -1px 2px 19px 1px rgba(0, 0, 0, 0.3);
-moz-box-shadow: -1px 2px 19px 1px rgba(0, 0, 0, 0.3);
box-shadow: -1px 2px 19px 1px rgba(0, 0, 0, 0.3);
}
.icon-button .icon-circle {
width: 22px;
height: 22px;
background: #fff;
border-radius: 100%;
margin: 23px auto;
color: #e29a1f;
font-size: 13px;
line-height: 29px;
text-shadow: none;
}
<div class="edit-button">
<button class="icon-button">
Shop
<br>MYMARKET.GE
<div class="icon">
<div class="icon-circle"><i class="ic-link"></i>
</div>
</div>
</button>
</div>

问题来了

enter image description here

最佳答案

您可以在 icon-button 上使用伪造

.icon-button::before {
content: '';
position: absolute;
width: 26px;
height: 69px;
right: -40px;
top: -1px;
background: #fcac22;
border-radius: 0 2px 3px 0;
z-index: -1;
-webkit-box-shadow: -1px 2px 19px 1px rgba(0, 0, 0, 0.3);
-moz-box-shadow: -1px 2px 19px 1px rgba(0, 0, 0, 0.3);
box-shadow: -1px 2px 19px 1px rgba(0, 0, 0, 0.3);
}

示例

* {
box-sizing: border-box;
}

.edit-button {
padding: 8px 12px;
width: 500px;
margin: 50px auto;
}

.icon-button {
position: relative;
background: #fcac22;
border-top: 1px solid #f9aa22;
border-right: none;
border-bottom: 3px solid #e29a1f;
border-left: 1px solid #f7a921;
color: #fff;
border-radius: 2px 0 0 3px;
outline: none;
text-align: center;
width: calc(100% - 36px);
height: 69px;
line-height: 18px;
padding: 19px;
text-shadow: 0px 0px .1px #fff;
z-index: 1;
-webkit-box-shadow: -1px 2px 19px 1px rgba(0, 0, 0, 0.3);
-moz-box-shadow: -1px 2px 19px 1px rgba(0, 0, 0, 0.3);
box-shadow: -1px 2px 19px 1px rgba(0, 0, 0, 0.3);
font-family: arial;
font-size: 16px;
font-weight: 400;
}
.icon-button::before {
content: '';
position: absolute;
width: 26px;
height: 69px;
right: -38px;
top: -1px;
background: #fcac22;
border-radius: 0 2px 3px 0;
-webkit-box-shadow: -1px 2px 19px 1px rgba(0, 0, 0, 0.3);
-moz-box-shadow: -1px 2px 19px 1px rgba(0, 0, 0, 0.3);
box-shadow: -1px 2px 19px 1px rgba(0, 0, 0, 0.3);
}

.icon-button .icon {
position: absolute;
width: 32px;
height: 69px;
display: inline-block;
right: -36px;
top: -1px;
background: #fcac22;
border-top: 1px solid #f9aa22;
border-right: 1px solid #f7a921;
border-bottom: 3px solid #e29a1f;
border-left: none;
border-radius: 0 2px 3px 0;
z-index: 0;
}
.icon-button .icon-circle {
display: inline-block;
width: 22px;
height: 22px;
background: #fff;
border-radius: 100%;
margin: 23px auto;
color: #e29a1f;
font-size: 13px;
line-height: 29px;
text-shadow: none;
}
<div class="edit-button">
<button class="icon-button">
Shop
<br>MYMARKET.GE
<span class="icon">
<span class="icon-circle"><i class="ic-link"></i>
</span>
</span>
</button>
</div>

John Bupit 指出的注释, div 元素在 button 元素中是不允许的,所以我对上面的代码进行了必要的更改,将 div 替换为 span 并将 display: inline-block 添加到 .icon-button .icon-circle 规则

关于html - Box-Shadow 在其他元素上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42019726/

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