I have seen this so many times until now, but I never used myself. Can somebody explain how you can get specific icon picture from this single png image, for example the icons i selected with red ... using css
Icon used by browsers to identify a webpage or site. While all browsers support the . ico format, the PNG format can be preferable.
Windows uses ICO files for its icons. Thus, you'll need to convert images from PNG (or other image formats) before you use them as icons. ConvertICO offers an easy way to do this. You can upload up to 50 PNG images at once to convert them into the ICO format.
That is called CSS sprites. It is used to cut down the http requests. Basically all icons are placed on a single canvas and are used as background-image
property and later they are mapped using CSS background-position
property, so for example
.icon1 {
background-image: url('YOUR_URL_HERE');
background-position: 10px 10px; /* X and Y */
height: 30px;
width: 30px;
}
Demo
So inshort just define a fix height/width to your element, and than map the canvas using background-position
property. Hence, if you have 100 small icon images on a page, it will make 100 requests to the server, thus to increase the performance, CSS Sprites are used.
height
and width
on an elementbackground-image
background-position
so the part of the image you want to be visible is in viewIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With