simona6 Posted October 22 Share Posted October 22 We have website where hovering over the Product photo reveals the full size image, so it kind of "zooms". Trouble is, many old photos are smaller than the container. Is there a way in CSS to set the minimum size to say 600x600px... even if it stretches it... but when you get an image that is BIG... is still shows the full size? Quote Link to comment https://forums.phpfreaks.com/topic/325139-can-you-set-a-minimum-height-and-width-of-a-background-image/ Share on other sites More sharing options...
gizmola Posted October 22 Share Posted October 22 Css has background-size where 'cover' or possibly 'auto' should do what you want, although it will honor the original aspect ratio, which will result in some cropping if the aspect ratio differs. Usually people don't use square pictures. Quote Link to comment https://forums.phpfreaks.com/topic/325139-can-you-set-a-minimum-height-and-width-of-a-background-image/#findComment-1638527 Share on other sites More sharing options...
maxxd Posted October 22 Share Posted October 22 Don't forget you'll be sacrificing image quality if you upscale the images. This might not be an issue, but every b2c catalog site I've built has wanted good, crisp photos of their products. Quote Link to comment https://forums.phpfreaks.com/topic/325139-can-you-set-a-minimum-height-and-width-of-a-background-image/#findComment-1638531 Share on other sites More sharing options...
simona6 Posted October 23 Author Share Posted October 23 Cover won't work. The website uses a Zoom classed DIV to show the "full size" image when you hover over it. If we did Cover, it would simply show it to "fill the box". The idea is when you zoom over, as it is the original image, it's like running a Mag glass over it. But we want to set a Min Width/Height, so if the image is too small, it will stretch it (don't care about quality). Possible? Quote Link to comment https://forums.phpfreaks.com/topic/325139-can-you-set-a-minimum-height-and-width-of-a-background-image/#findComment-1638566 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.