如何在materializecss中更改线性进度条的颜色?

时间:2019-07-20 06:54:54

标签: html css

我正在使用物化CSS。你们能告诉我如何改变颜色吗 线性预加载器?

<div class="progress">
    <div class="indeterminate"></div>
</div>

我想将颜色更改为蓝色。

4 个答案:

答案 0 :(得分:4)

我查看了该框架的sass文件,实际上您需要定位:

.progress {
    background-color: darkblue;
}


.progress .indeterminate {
    background-color: steelblue;
}

https://codepen.io/doughballs/pen/BaNVOBQ

答案 1 :(得分:2)

尝试一下,我认为这对您有帮助。

html

<div class="progress">
    <div class="indeterminate"></div>
</div>

css

/* Progress Bar */
.progress {
  position: relative;
  height: 4px;
  display: block;
  width: 100%;
  background-color: #acece6;
  border-radius: 2px;
  background-clip: padding-box;
  margin: 0.5rem 0 1rem 0;
  overflow: hidden; }

  .progress .indeterminate {
    background-color: red; }
    .progress .indeterminate:before {
      content: '';
      position: absolute;
      background-color: inherit;
      top: 0;
      left: 0;
      bottom: 0;
      will-change: left, right;
      -webkit-animation: indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite;
              animation: indeterminate 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite; }
    .progress .indeterminate:after {
      content: '';
      position: absolute;
      background-color: inherit;
      top: 0;
      left: 0;
      bottom: 0;
      will-change: left, right;
      -webkit-animation: indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
              animation: indeterminate-short 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) infinite;
      -webkit-animation-delay: 1.15s;
              animation-delay: 1.15s; }

@-webkit-keyframes indeterminate {
  0% {
    left: -35%;
    right: 100%; }
  60% {
    left: 100%;
    right: -90%; }
  100% {
    left: 100%;
    right: -90%; } }
@keyframes indeterminate {
  0% {
    left: -35%;
    right: 100%; }
  60% {
    left: 100%;
    right: -90%; }
  100% {
    left: 100%;
    right: -90%; } }
@-webkit-keyframes indeterminate-short {
  0% {
    left: -200%;
    right: 100%; }
  60% {
    left: 107%;
    right: -8%; }
  100% {
    left: 107%;
    right: -8%; } }
@keyframes indeterminate-short {
  0% {
    left: -200%;
    right: 100%; }
  60% {
    left: 107%;
    right: -8%; }
  100% {
    left: 107%;
    right: -8%; }
 }

答案 2 :(得分:1)

解决方案1:

<div class="progress">
    <div class="indeterminate"></div>
</div>

background-color添加到两个类progressindeterminate

.progress{
    background-color: blue;
}
.indeterminate{
    background-color: yellow;
}

解决方案2:

仅使用具体化的颜色类。

<div class="progress blue">
    <div class="indeterminate yellow"></div>
</div>

答案 3 :(得分:0)

.progress{
      margin-top:50%;
      background-color:gray;
}
.progress .indeterminate {

    background-color: orange;
}

您只需要更改这两个CSS。