Does the line of code below need repetition? When i remove the duplicate, it does not seem to work. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Does the line of code below need repetition? When i remove the duplicate, it does not seem to work.

div.first { height: 150px; width: 200px; color: #FFF; background: -moz-radial-gradient(top left, green, yellow, blue); background: -webkit-radial-gradient(top left, green, yellow, blue); background: -ms-radial-gradient(top left, green, yellow, blue); } div.second { height: 150px; width: 200px; color: #FFF; background: -moz-radial-gradient(green 5%, yellow 15%, blue 60%); background: -webkit-radial-gradient(green 5%, yellow 15%, blue 60%); background: -ms-radial-gradient(green 5%, yellow 15%, blue 60%); } ...,...................... The HTML CODE <div class="first">Top Left</div> <br /> <div class="second">In Percentages</div> .......................... This is a code lesson from CSS under Gradient &Background >Radial Gradient Position

13th Jul 2020, 7:31 PM
Ubi Fredrick Ofem
Ubi Fredrick Ofem - avatar
3 Answers
+ 1
There is no repetition, these are three different lines defining the same for three different browser "interpretations" (implementations).
14th Jul 2020, 8:28 AM
Sandra Meyer
Sandra Meyer - avatar
+ 1
What kind of repetition do you mean? The different definitions for div of class first and second? They are not equal. And if you want to use the completely same CSS for both div elements, then you can easily remove the other definition, but you have to refer to the remaining class then of course.
14th Jul 2020, 2:32 AM
Sandra Meyer
Sandra Meyer - avatar
+ 1
The repetition I mean is this: background: -moz-radial-gradient(top left, green, yellow, blue); Do I need to repeat them three times for each div ?
14th Jul 2020, 8:20 AM
Ubi Fredrick Ofem
Ubi Fredrick Ofem - avatar