Home >Web Front-end >HTML Tutorial >css sprite adjusts the size of small icons in large pictures_html/css_WEB-ITnose

css sprite adjusts the size of small icons in large pictures_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:00:291226browse

Let’s talk about the solution directly:


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

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

Normally take the image:

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

Now take half the normal icon size:

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



OK, you’re done!

Statement:
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