How do you add a linear gradient as a background for an image? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How do you add a linear gradient as a background for an image?

I want to add a certain gradient behind each picture to represent each character, but I can't figure out how https://code.sololearn.com/WDTwaYmxnuy3/?ref=app

23rd Feb 2020, 2:57 AM
Aiki
Aiki - avatar
5 Answers
23rd Feb 2020, 3:46 AM
Sudarshan Rai
Sudarshan Rai - avatar
+ 2
// Kyōka (Aiki) linear gradient is active behind your image's , only image is overlapping it, give that background to image Container
23rd Feb 2020, 3:38 AM
Sudarshan Rai
Sudarshan Rai - avatar
+ 2
// Kyōka (Aiki) you applied image background linear gradient .JIROU {background-image:linear-gradient(purple, black);} but as images loads linear background will be covered by image , so you can give a linear gradient to image Container , means place image inside div and give background to that div
23rd Feb 2020, 3:44 AM
Sudarshan Rai
Sudarshan Rai - avatar
+ 2
Try to set img with opacity selector, and set div with img width. https://code.sololearn.com/W3jW7g006La7/?ref=app
23rd Feb 2020, 4:55 AM
Calviղ
Calviղ - avatar
+ 1
Sudarshan Rai 👑 What do you mean by that? Sorry, I just am confused by how you said that.
23rd Feb 2020, 3:39 AM
Aiki
Aiki - avatar