Css text styling with image

32 Views Asked by At

I'm styling my letters using an image as the content of the letters. The letters are small and the image big, and I would like to have more control over the image size. What is the css properties to do so?

 background-image: url(https://files.cargocollective.com/c2106023/Menu.jpg);
  background-size: contain;
 -webkit-text-fill-color: transparent;
 -webkit-background-clip: text;
 -moz-background-clip:text;
1

There are 1 best solutions below

0
Shivam Pathak On

To have more control over the size of the background image within the letters, you can adjust the background-size property to specific dimensions. Here's how you can modify your CSS:

background-image: url(https://files.cargocollective.com/c2106023/Menu.jpg);
background-size: 50px 50px; /* Adjust the dimensions as needed */
background-repeat: no-repeat; /* Prevent the image from repeating */
-webkit-text-fill-color: transparent;
-webkit-background-clip: text;
-moz-background-clip: text;

For your case you can keep, background-size: 50px 50px; which sets the size of the background image to 50 pixels in width and 50 pixels in height. You can change these values according to your requirements to get the desired size for the background image.