Home > Web Front-end > CSS Tutorial > css sprite adjusts the size of small icons in large pictures

css sprite adjusts the size of small icons in large pictures

高洛峰
Release: 2016-11-24 09:19:06
Original
1528 people have browsed it

Let’s talk about the solution directly:

css sprite adjusts the size of small icons in large pictures

Assume that the size of a combined large picture is: 900 x 1000 px (as shown in the picture above)

Now I want to take the hippopotamus icon in the upper left corner of the picture and reduce the size of the icon.

Normal image selection:

.sprite {
background: url('imgs/woqu_localjoin_all.png') no-repeat -21px -80px;
width: 190px;
height: 154px;
}
Copy after login

Now select half of the normal icon size:

<pre name="code" class="html">.sprite {
background: url(&#39;all.png&#39;) no-repeat -10px -40px;
width: 95px;
height: 74px;
background-size:450px 500px;
}
Copy after login

OK, you’re done!

Finally, I recommend you a css sprite measurement tool: http://www.spritecow.com/

Open it and drag the assembled png image in:

css sprite adjusts the size of small icons in large pictures

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template