Jump to content

Can you set a minimum height and width of a Background Image?


Recommended Posts

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?

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.

 

 

 

 

 

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?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.