How to use CSS Sprites ?

webdesign

New member
Joined
Jul 5, 2012
Messages
229
Points
0
For example you have a button with two status are normal and hover states, each state has a corresponding background. Normally you will save two files normal.gif (16x16px) and hover.gif (16x16px).
Now create a file using PS picture.gif (32x16px) then copy paste to 2 other images, the image on the left to normal, the right to hover image, like puzzle games so that.
Set CSS with code
a{
background: #FFFFFF url("picture.gif") left no-repeat;
}
a:hover{
background: #FFFFFF url("picture.gif") -16px no-repeat;
}
just simple way to make css sprites :)
 

madelinekim

New member
Joined
Aug 8, 2012
Messages
34
Points
0
When you use CSS spirits you have to keep some points in mind such as CSS files are little bit heavier, Give attention when you are using repeat. For using the CSS spirits you have to put multiple files together in one file.
 

hoangvu

New member
Joined
Jun 6, 2012
Messages
1,831
Points
0
Thanks for all info, I've never used css sprites but now I can know abit about it
 
Older threads
Replies
0
Views
6,740
Replies
2
Views
6,477
Replies
11
Views
9,111
Replies
20
Views
13,961
Replies
2
Views
5,943
Newer threads
Replies
2
Views
6,961
Replies
33
Views
107,400
Replies
9
Views
10,144
Replies
1
Views
7,955
wms
Latest threads
Replies
1
Views
63
Replies
0
Views
58
Replies
1
Views
109
Replies
0
Views
104
Recommended threads
Replies
7
Views
8,620
Replies
5
Views
5,688
Replies
11
Views
10,662
Replies
5
Views
3,823
Top