开发者

What is it called when JS is used to show only a certain part of a png?

开发者 https://www.devze.com 2023-02-06 00:07 出处:网络
Let\'s say you have a png and it contains all of the icons that are to be used on one page, what is the process of using JS to select and display on a certain icon in that image? I\'ve always seen it

Let's say you have a png and it contains all of the icons that are to be used on one page, what is the process of using JS to select and display on a certain icon in that image? I've always seen it being done, but it seems to evade me what it is, and how t开发者_开发百科o do it.


It's done with CSS, not JavaScript, and it's called sprites.

http://css-tricks.com/css-sprites/


You would use CSS and if you want it to be a really painless experience use this website below.

http://www.spritebox.net/

It will take care of generating the picture and also making generating the CSS you will need to output the icons.


Sprites, but you would probably use CSS rather than Javascript.


I guess you are referring to sprite image. js or css can be used to select images.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号