0

How to make button adapt to background image size?

Hello guys! I want to set a background-image for a button, but it doesn`t fit the size of a button itself. Of course, I can just set height and width for button itself, but this will not be useful if there will be many elements with images as background. Now my code looks like this: #a { min-width: 100px; min-height: 100px; background-size: cover; background-image: url(); } This code shows only part of my image, and that is why I am here, waiting for your advice:) Thanks a lot!

30th Jan 2022, 3:34 PM
Just_Odessa
2 Answers
30th Jan 2022, 3:39 PM
JaScript
JaScript - avatar
+ 1
Thank you! This worked, but vice verca. It made the backhround image adapt to the button size, while I need button to adapt to different images. Maybe there are some other solutions?
31st Jan 2022, 9:55 AM
Just_Odessa