我目前在页面底部显示两个三角形,一个在左侧,一个在右侧。右边的三角形是透明的,两个三角形都只有一种颜色。
我想让三角形 triangle-bottom-right
增加一个渐变级别(额外的颜色停止点)。
它应该从左到右开始,以 rgba(70, 70, 70, 0.15)
开始,并以 rgba(70, 70, 70, 0)
结束。目标浏览器是 Chrome(通过 Electron 运行)。
结果三角形应能够调整大小以适应浏览器宽度,高度是恒定的。
我的 CSS:
.triangle-footer {
position: relative;
bottom: 0px;
height: 176px;
width: 100%;
}
.triangle-bottom-left {
position: absolute;
width: 40%;
height: 100%;
left: 0px;
bottom: 0px;
background: linear-gradient(to right top, rgba(94, 194, 82, 100) 50%, rgba(255, 255, 255, 0) 50%);
}
.triangle-bottom-right {
position: absolute;;
width: 125%;
height: 140%;
right: 0px;
bottom: 0px;
background: linear-gradient(to left top, rgba(70, 70, 70, 0.15) 50%, rgba(255, 255, 255, 0) 50%);
}
我的HTML:
<div class="ui fixed bottom sticky triangle-footer">
<div class="triangle-bottom-left"></div>
</div>
<div class="ui fixed bottom sticky triangle-footer">
<div class="triangle-bottom-right"></div>
</div>
(使用Semantic-UI实现底部固定)