?
Solved

Change background size of sprites

Posted on 2014-02-15
5
Medium Priority
?
262 Views
Last Modified: 2014-03-14
Hi

I have icons that use a sprite. They are 60px by 60px. For mobile i want to reduce them down to 35px by 35px.

I dont really want to create seperate sprite image for mobile .

Is this possible with CSS?

Thanks
0
Comment
Question by:coolispaul
[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
5 Comments
 
LVL 29

Expert Comment

by:sammySeltzer
ID: 39861738
One way I know how is to define the dimensions in css:

.bg_image_resize
{
    background-image:url('/yourfolder/yourimage.jpg');
    width:35px;
    height:35px;
}

Open in new window


Then usage:

<span class="bg_image_resize"></span>

It may be something other than <span> since no code is shown
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 1500 total points
ID: 39861739
Trying to avoid using different dimensioned sprites is almost certainly not going to get anything reliable.  The closest thing might be to use transform:scale() after detecting the device, or through a media query but that is 100% guaranteed to have cross-browser, cross-browser versions and cross-device issues that will never be fully resolved because each new device will add new challenges.

It takes about 30 seconds in any graphics program to create a new version and about 10 seconds to ad a media query to the CSS; while trying to get to work without using new versions of the graphics could take weeks and will never be as reliable as using additional sets of sprites.

BTW mobile devices do not use a standard size or specification for the size of a pixel.

Cd&
0
 

Author Comment

by:coolispaul
ID: 39864236
ok thanks dinosaur

I'll use different sprites then. I thought this might be best...

Cheers
0
 
LVL 58

Expert Comment

by:Gary
ID: 39928731
I've requested that this question be closed as follows:

Accepted answer: 500 points for COBOLdinosaur's comment #a39861739

for the following reason:

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

777 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