How to use CSS Sprites ?

hoangvu

New member
Joined
Jun 6, 2012
Messages
1,844
Points
0
anyone know how to use CSS Sprites to make different backgrounds in a image file ?
Thanks
 

webdesign

New member
Joined
Jul 5, 2012
Messages
232
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,844
Points
0
Thanks for all info, I've never used css sprites but now I can know abit about it
 
Older threads
Replies
1
Views
4,522
Replies
2
Views
4,073
Replies
12
Views
6,581
Replies
20
Views
10,035
Replies
2
Views
4,884
Newer threads
Replies
2
Views
4,488
Replies
34
Views
66,101
Replies
9
Views
6,944
Replies
2
Views
5,416
wms
Latest threads
Replies
1
Views
99
Replies
1
Views
104
Replies
1
Views
166
Replies
1
Views
204
Replies
1
Views
281
Recommended threads
Replies
6
Views
3,167
Replies
3
Views
1,517
Replies
3
Views
1,810
Replies
5
Views
3,117

Referral contests

Referral link for :

Sponsors

Popular tags

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top