html - Change the flow of colours in a CSS gradient -


i use <div class="menu"></div> , set background color gradient.

enter image description here

it floats red in top white in bottom. here .css code:

.menu {     background-color: #fff;     background-image: -webkit-gradient(linear, left top, left bottom, from(#791014), to(#fff));     background-image: -webkit-linear-gradient(top, #791014, #fff);     background-image: -moz-linear-gradient(top, #791014, #fff);     background-image: -ms-linear-gradient(top, #791014, #fff);     background-image: -o-linear-gradient(top, #791014, #fff);     background-image: linear-gradient(top, #791014, #fff);     clear: both; } 

i starting , end color. question is, if there way can change how flows red (top) white (bottom) example switches earlier white, have dark red @ beginning of top in middle more white.

in other words, want change how fast transitions red white.

if want transition between colors happen quicker normal , change point transition should completed. when 2 colors given without color-stop percentage first color starts @ 0% , in between colors calculated such second color reached @ 100% mark (100% = container's height default or background-size in y-axis if specified). instead of give lower value white color. in below snippet, have given 60% , background reaches white color time reaches 60% of container's height.

note:

  • 100% = container's height (default) or background-size in y-axis (if specified) vertical gradient.
  • 100% = container's width (default) or background-size in x-axis (if specified) horizontal gradient.

div {    float: left;    height: 100px;    width: 200px;    line-height: 100px;    text-align: center;    margin-right: 5px;  }  .menu-60 {    background-color: #fff;    background-image: -webkit-linear-gradient(top, #791014 0%, #fff 60%);    background-image: -moz-linear-gradient(top, #791014 0%, #fff 60%);    background-image: -ms-linear-gradient(top, #791014 0%, #fff 60%);    background-image: -o-linear-gradient(top, #791014 0%, #fff 60%);    background-image: linear-gradient(top, #791014 0%, #fff 60%);  }  .menu-40 {    background-color: #fff;    background-image: -webkit-linear-gradient(top, #791014 0%, #fff 40%);    background-image: -moz-linear-gradient(top, #791014 0%, #fff 40%);    background-image: -ms-linear-gradient(top, #791014 0%, #fff 40%);    background-image: -o-linear-gradient(top, #791014 0%, #fff 40%);    background-image: linear-gradient(top, #791014 0%, #fff 40%);  }  .menu-80 {    background-color: #fff;    background-image: -webkit-linear-gradient(top, #791014 0%, #fff 80%);    background-image: -moz-linear-gradient(top, #791014 0%, #fff 80%);    background-image: -ms-linear-gradient(top, #791014 0%, #fff 80%);    background-image: -o-linear-gradient(top, #791014 0%, #fff 80%);    background-image: linear-gradient(top, #791014 0%, #fff 80%);  }  br {    clear: both;  }
<script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>    <h3>red white @ 60%</h3>  <div class='menu-60'>text</div>  <div class='menu-60'>text</div>  <div class='menu-60'>text</div>    <br/>    <h3>red white @ 40%</h3>  <div class='menu-40'>text</div>  <div class='menu-40'>text</div>  <div class='menu-40'>text</div>    <br/>    <h3>red white @ 80%</h3>  <div class='menu-80'>text</div>  <div class='menu-80'>text</div>  <div class='menu-80'>text</div>


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -