CSS Sprites alternative for non backgrounds

Discussion in 'CSS' started by mariuscmr, Dec 7, 2009.

  1. #1
    Hello,

    I wonder if there is an alternative for sprites technique, this time for non css backgrounds.

    Let's say I want to use multiple images with
    <img>
    Code (markup):
    tag but I don't want multiple images for each source as I want to keep the http requests as low as possible. I'd like to refer to one single "sprite" image. I don't mind to use inline or external css to achieve this. But the question is: is this possible without using background positioning?

    I hope I made myself clear.

    Thank you,
    Marius
     
    mariuscmr, Dec 7, 2009 IP
  2. Typo Tat

    Typo Tat Peon

    Messages:
    115
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I've never thought about this, but now that you mention it, I suppose technically it can be done.

    Imagine you have a DIV with set width and height and overflow:hidden. Inside it you could place an IMG whose dimensions are bigger than the DIV, then you play around with the positioning of that IMG, revealing only the parts you want.

    Mind, I've just thought it up. It would probably work, but there might be complications.
     
    Typo Tat, Dec 7, 2009 IP
  3. mariuscmr

    mariuscmr Peon

    Messages:
    84
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    What about using mapping? I have to try it...
     
    mariuscmr, Dec 7, 2009 IP