This content originally appeared on DEV Community and was authored by Shuvo
Image as text background looks really awesome right? However doing this doesn't really work
.text{
background-image: url("./img/img.jpg");
}
But we can achieve our desired effect by adding just two more lines of code
.text{
background-image: url("./img/img.jpg");
color: transparent;
background-clip: text;
}
To ensure better reliability we can use some browser prefixes. eg
.text{
background-image: url("./img/img.jpg");
color: transparent;
background-clip: text;
-webkit-background-clip: text;
}
This content originally appeared on DEV Community and was authored by Shuvo

Shuvo | Sciencx (2021-10-18T14:13:43+00:00) Image as text background in CSS. Retrieved from https://www.scien.cx/2021/10/18/image-as-text-background-in-css/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.