Here is a jsFiddle that demonstrates the process to have both a fixed sized using position:fixed
in a outer div while an inner div holding the image is using background-size:contain
.
EDIT: Now an extra div is used to include any border requirements too!
EDIT-2: Updated jsFiddle with :contain
, not :cover
along with non-abstract image.
For old browsers such as IE6-8 there are many plugins to choose from that allow the use of CSS3 Styles. This jQuery Plugin named backgroundSize.js is specifically for the use of :cover
and :contain
for background-size
and is provided by SO member Louis-Rémi if you need that option.