If you reduce your window browser width while you’re on http://twitter.github.com/bootstrap/examples/carousel.html you can see that the background image aspect ratio changes.
I would like to maintain it (1:1), cropping my image on the left, or on the right, or aligning it horizontally.
What do you suggest?
You’ve got 2 options, and both maintain the image ratio:
Option 1
The last part is the
background-size: coverproperty. It will make the background image zoom in depending on the browser width, to make sure it fills the whole div.Example: https://i.stack.imgur.com/xnhev.png
Option 2
It’s the same effect but without the zoom in part. The background will keep its aspect and remain centered, but if your browser width is bigger than your image width (in this case, 1500px), you’ll see the background-color (in this case white).
Example: https://i.stack.imgur.com/NpXBK.png
I recommend option 1. You only see the zooming effect if you resize your browser but almost nobody does, and the visitor will only see a filled background.