【发布时间】:2017-05-25 09:15:51
【问题描述】:
css 问题。
是否可以在边框上添加一个渐变,以反映到上面的 div?
我可以添加纯色,但似乎找不到渐变色。
.offerBox {
width: 360px;
height: 170px;
position: relative;
border-radius: 5px;
background: linear-gradient(to right, #fcd651 0%,#f9c100 100%);
}
.offerBox:after {
top: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(136, 183, 213, 0);
border-top-color: #f9c100;
border-width: 30px;
margin-left: -30px;
}
<div class="offerBox"></div>
谢谢!
【问题讨论】:
-
如果你需要对齐底部中心,你可以使用 transform:rotate(45deg) translate(-50%, 0);在 .offerBox:after 并根据需要更新顶部。检查我的更新答案
标签: css border gradient linear-gradients