css问题。CSS渐变边框:
是否可以添加一个渐变到边界反映到上面的div?
我可以添加一个纯色,似乎无法找到一个渐变的东西。
\t .offerBox {
\t \t width: 360px;
\t \t height: 170px;
\t \t position: relative;
\t \t border-radius: 5px;
\t \t background: linear-gradient(to right, #fcd651 0%,#f9c100 100%);
\t }
\t
\t .offerBox:after {
\t \t top: 100%;
\t \t left: 50%;
\t \t border: solid transparent;
\t \t content: " ";
\t \t height: 0;
\t \t width: 0;
\t \t position: absolute;
\t \t pointer-events: none;
\t \t border-color: rgba(136, 183, 213, 0);
\t \t border-top-color: #f9c100;
\t \t border-width: 30px;
\t \t margin-left: -30px;
}
<div class="offerBox"></div>
谢谢!
如果你需要居中对齐底部,你可以使用变换:旋转(45deg)转换(-50%,0);在.offerBox中:根据需要更新top。检查我的更新回答 – LKG