0
我在div
(#telegram-join
)下创建伪元素箭头,它们都具有背景/边框颜色作为RGBA值(rgba(255, 255, 255, 0.25)
),但箭头受到不同的影响并显示比div
暗。这是因为它更小?我怎么能匹配他们?谢谢!伪元素RGBA箭头颜色与父元素不匹配
HTML
<div id="telegram-join" class="bg-combo">
<h1><i class="fa fa-telegram"></i> Chat with us on Telegram</h1>
</div>
CSS:
.bg-combo {
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto;
border-radius: 8px;
padding: 5px 10px;
width: fit-content;
background-color: white;
background-color: rgba(255, 255, 255, 0.25);
text-align: center;
}
.bg-combo h1 {
display: inline-block;
font-size: 2em;
line-height: 1.5;
text-transform: uppercase;
}
.bg-combo h1 i {
margin-right: 10px;
}
#telegram-join {
position: relative;
margin: 15px auto 25px;
}
#telegram-join :after {
position: absolute;
top: 100%;
left: 50%;
transform: rotate(-45deg);
transform-origin: 50% 50%;
margin-left: -15px;
margin-top: -15px;
border: 15px solid #fff;
width: 0;
height: 0;
border-color: transparent transparent rgba(255, 255, 255, 0.25) rgba(255, 255, 255, 0.25);
content: '';
}
演示:CodePen
Gotcha。我有一种感觉,它可能是一个等级问题。我没有使用十六进制值来简化不透明度控制。谢谢! –