Solved

slice image using css sprite

Posted on 2010-09-01
4
1,014 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

705 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