I am trying to crop an image for screen sizes below a width of 768 pixels. The image should crop the same on the left and right sides.
Here is an example image in full size (image dimensions are 900px wide and 250px high:

Here is the cropped version I'm trying to create when the screen size is less than 768p. In this version, the image has a width of 320 pixels, but it should start with 768 pixels:

Here is the HTML I have used so far:
<div class="container"> <div class="image-container"> <img src="http://i.imgur.com/H7cpsLK.jpg" /> </div> </div>
Here is the CSS:
.container { width: 1280px; max-width: 100%; min-width: 768px; } .image-container { width:100%; } img { max-width:100%; height:auto; } @media only screen and (max-width:768px) { .image-container {max-width:768px; overflow:hidden;} }
Here is the fiddle I used to try to create this: http://jsfiddle.net/QRLTd/
Is it possible to crop the image from both the left and the right side at the same time?
source share