Solved

slice image using css sprite

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
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 style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will learn how to dynamically set the form action using jQuery.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now