100% stretch image
Permalink
Hi all,
I'm sure this is a simple one, but I would like to be able to add an image to a block (which is 100% wide and fixed height) and have the image auto-resize to 100%, in a similar way if you do it with a background size property with a background image. Does anyone know what css i would need to do this?
thanks for looking
I'm sure this is a simple one, but I would like to be able to add an image to a block (which is 100% wide and fixed height) and have the image auto-resize to 100%, in a similar way if you do it with a background size property with a background image. Does anyone know what css i would need to do this?
thanks for looking
If you leave the image size ( i.e. width="" or height="" it should resize to 100% If you want the block to have a background wrap it in a div and use css for background
I've tried that but it doesn't centre it nicely like the cover property would say for a background.
An alternative thought, how would you go about creating a block where by when you added the image it became the background so in the css you could just put the background properties there and it would resize nicely?
thanks for your quick reply by the way!
An alternative thought, how would you go about creating a block where by when you added the image it became the background so in the css you could just put the background properties there and it would resize nicely?
thanks for your quick reply by the way!
I think there is a background stretch jquery add-on even though I believe there are free ones online example -http://srobbin.com/jquery-plugins/backstretch/...
If you type background into the marketplace add-on there are a few that will stretch backgrounds.
If you type background into the marketplace add-on there are a few that will stretch backgrounds.
Like this one-
https://github.com/danmillar/jquery-anystretch...
https://github.com/danmillar/jquery-anystretch...
I've used those before, but do you think they could be tailored to change the background image of just a block not the background of the whole screen?