问题描述
我正在使用以下代码:
<div class="progress-container"></div>
.progress-container {
width: 100%;
height: 11px;
position: relative;
background: #EAEFF5;
border-radius: 5px;
z-index: -1;
Box-shadow:
80px 0 0 #0AA693 inset,500px 0 0 #FF7800 inset;
}
感谢您的帮助。
解决方法
我认为使用框阴影无法做到这一点,因为您无法为 x
位置设置起点。
.progress-container {
width: 100%;
height: 11px;
position: relative;
background: #EAEFF5;
border-radius: 5px;
}
.progress-container::before,.progress-container::after {
content: "";
position: absolute;
border-radius: inherit;
width: 100%;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
.progress-container::before {
background-color: #FF7800;
width: 500px;
}
.progress-container::after {
background-color: #0AA693;
width: 80px;
}
<div class="progress-container">
</div>
只需增加X轴,在初始faze中将其设置为80px,80px 0 0 #0AA693 inset,
这是阴影,第一个数字是X轴,第二个数字是Y轴,第三个数字是模糊。因此,将其更改为类似 400px 0 0 #0aa693
的内容,这就是解决方案。
.progress-container {
width: 100%;
height: 30px;
position: relative;
background: #eaeff5;
border-radius: 3px;
z-index: -1;
box-shadow: 400px 0 0 #0aa693 inset,500px 0 0 #ff7800 inset;
}