| <style> |
| .box { |
| display: inline-block; |
| height: 120px; |
| width: 200px; |
| margin: 10px; |
| border: 1px solid black; |
| background-repeat: no-repeat; |
| } |
| |
| .linear1 { |
| background-image: -webkit-linear-gradient(left, red calc(25%), green calc(50%), blue calc(75%)); |
| background-image: -moz-linear-gradient(left, red calc(25%), green calc(50%), blue calc(75%)); |
| } |
| |
| .linear2 { |
| /* Green should get shifted to calc(50%) */ |
| background-image: -webkit-linear-gradient(left, red calc(50%), green calc(30%), blue calc(90%)); |
| background-image: -moz-linear-gradient(left, red calc(50%), green calc(30%), blue calc(90%)); |
| } |
| |
| .linear3 { |
| background-image: -webkit-linear-gradient(red calc(-50%), green, blue, green, blue calc(150%)); |
| background-image: -moz-linear-gradient(red calc(-50%), green, blue, green, blue calc(150%)); |
| } |
| |
| .linear4 { |
| background-image: -webkit-linear-gradient(left, red, green calc(100px), blue); |
| background-image: -moz-linear-gradient(left, red, green calc(100px), blue); |
| } |
| |
| .linear5 { |
| background-image: -webkit-linear-gradient(left, red, green calc(120%), blue); |
| background-image: -moz-linear-gradient(left, red, green calc(120%), blue); |
| } |
| |
| .linear6 { |
| background-image: -webkit-linear-gradient(left, red, green calc(50% + 20px), blue); |
| background-image: -moz-linear-gradient(left, red, green -moz-calc(50% + 20px), blue); |
| } |
| </style> |
| <body> |
| <div class="linear1 box"></div> |
| <div class="linear2 box"></div> |
| <div class="linear3 box"></div> |
| <br> |
| <div class="linear4 box"></div> |
| <div class="linear5 box"></div> |
| <div class="linear6 box"></div> |
| </body> |