No replies
boeledi
boeledi's picture
Offline
newbie
Last seen: 8 years 23 weeks ago
Timezone: GMT+2
Joined: 2011-04-27
Posts: 1
Points: 2

Hi,

In order to improve the load time of my website, I am looking for a method to reduce the number of HTTP requests.
To do this, I use the CSS Sprites technique.

However, I sometimes need to use <img src=... /> to use some auto-size functionality (case of auto size div background). The drawback of this, is that for each <img src=... /> a HTTP request is posted.

My question:

I tried to use the CSS Sprites technique with <img>, as follows:

img.clsImg {
background: transparent url('.....') no-repeat;
width:100%;
height:100%;
border:0px;
}

<div .......>
<img class=clsImg alt='' />
</div>

The issue is that the background image is not resized... but cropped.

Is there any solution to this?

Many thanks