Solved

slice image using css sprite

Posted on 2010-09-01
4
1,004 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Jquery/JSON passing value from one function to another 12 38
Change Background Color of Website 5 17
How to position loader with CSS 3 40
div to fit another div 8 23
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

810 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