Solved

slice image using css sprite

Posted on 2010-09-01
4
1,008 Views
Last Modified: 2013-11-19
hi,
I have this image:

 to be sliced
I wanna the blue umbrella to be sliced using background and position css properties

I got it's coordination,

 x=111 px, y= 115 px
width = 34 px
height = 40 px

thanks
0
Comment
Question by:njgroup
  • 3
4 Comments
 
LVL 18

Expert Comment

by:Eternal_Student
ID: 33576164
You need something like this ... the coordinates are not completely accurate
.blueUmbrella{width:34px; height:40px; background:url(pokemon.gif) no-repeat -190px -83px;}

Open in new window

0
 
LVL 18

Accepted Solution

by:
Eternal_Student earned 500 total points
ID: 33576167
Full version:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
	.blueUmbrella{width:34px; height:40px; background:url(pokemon.gif) no-repeat -190px -83px;}
</style>
</head>
<body>
	<div class="blueUmbrella">&nbsp;</div>
</body>
</html>

Open in new window

0
 

Author Comment

by:njgroup
ID: 33577498
the width is for div or to tell the image how long the width is for rectangle to cut?
0
 
LVL 18

Expert Comment

by:Eternal_Student
ID: 33578416
The width is for the div, you use sprites as background images inside an element (such as a div).
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

838 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question