How can I write color stops when I use a repeating function? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can I write color stops when I use a repeating function?

There is an example in the lesson background: repeating-linear-gradient(blue, green 20px); How or where should I add color stops?

6th Feb 2017, 2:39 AM
Alex Yarotskyi
Alex Yarotskyi - avatar
4 Answers
+ 3
@visph It is not work for the last color. "green 200px" set repeating not color stops. For example div { height: 400px; background:repeating-linear-gradient(blue, red 25px, green 200px); } It repeat once (400px/200px=2). How to set color stops for last one?
11th Feb 2017, 2:50 AM
Alex Yarotskyi
Alex Yarotskyi - avatar
+ 2
background:repeating-linear-gradient(blue, red 25px, green 200px); Simply add how many colors ( and optionnaly dimensions ) you want ;)
7th Feb 2017, 8:16 PM
visph
visph - avatar
+ 1
Maybe just do: (blue, red 25px, green 200px, green) ? ... as first and last color values are logicaly respectively for 0 and 100% ^^ ( surely, I've just tested it )
11th Feb 2017, 3:23 AM
visph
visph - avatar
- 2
hallo Alex
21st Jun 2017, 7:20 PM
Majedul haq
Majedul haq - avatar