Hi,
I've been having a play around with CSS Sprites (trying to speed up my site)
I found a few good tutorials, including this one:
However, when I try and impliment the same method, it doesn't work for me :/
The image I'm using is:
..and the HTML:
The first one works:
..but the 2nd one doesn't:
Can anyone suggest what I'm doing wrong? Been scratching my head over this one for a good 45 mins now =)
I really wanna get the <img version working, so I can simply replace the iamge tags with the "classes" (and also some of them need links wrapped over them, so this makes it easier)
TIA
Andy
I've been having a play around with CSS Sprites (trying to speed up my site)
I found a few good tutorials, including this one:
However, when I try and impliment the same method, it doesn't work for me :/
The image I'm using is:
..and the HTML:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>foo</title>
<style>
.sprite {
background: url(images_joined.gif);
}
.translate {
background-position: -175px 0;
width: 160px;
height: 30px;
}
</style>
</head>
<body>
<div class="sprite translate"></div> <!-- works -->
<img src="transparant.gif" class="sprite translate" alt="test"> <!-- doesn't work -->
<hr>
<br /><br /><br />
<!--<img src="images_joined.gif">-->
</body>
</html>
The first one works:
Code:
<div class="sprite translate"></div>
..but the 2nd one doesn't:
Code:
<img src="transparant.gif" class="sprite translate" alt="test">
Can anyone suggest what I'm doing wrong? Been scratching my head over this one for a good 45 mins now =)
I really wanna get the <img version working, so I can simply replace the iamge tags with the "classes" (and also some of them need links wrapped over them, so this makes it easier)
TIA
Andy