This approach would not be simple and would not be productive. If you change your window a little bit, you would need your image width of 201, then 203, 205… Why?
The typical HTML approach is the opposite: you change the size of div according to the size of the image, automatically. Don't you think it would be much better? Perhaps you need to review your design and learn
liquid,
fluid and
elastic design. Please see my past answer and the links:
To Get Screen resolution[
^].
[EDIT]
After OP's clarification in the comments below:
I just tried it: you can use CSS
clip property:
http://www.w3schools.com/cssref/pr_pos_clip.asp[
^].
The practical use of it could be somewhat complicated: if you want to change the size dynamically, you have to write JavaScript modifying clip parameters depending on the current size of the parent
div
element. The best way of such manipulations would be using jQuery. Please see:
http://api.jquery.com/category/css/[
^].
—SA