Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS img src versus img background with CSS sprites??

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #32701
    boeledi
    Member

    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

    #76346
    Rob MacKay
    Participant

    I would say go back to your original method, then spend the time you were going to put into figuring it out learning something much more useful :) :D

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘CSS’ is closed to new topics and replies.