Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3396382
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:24:04+00:00 2026-05-18T04:24:04+00:00

What is the best way to create an HTML image that displays various states

  • 0

What is the best way to create an HTML image that displays various states (e.g. for a button: normal, hovered, selected, disabled)?
Ideally, I want to do via CSS classes (including the :hover meta-class).

Also, I’ve seen multiple states combined into a single image (which makes image pre-loading easier), but I don’t know how to display a single slice of the image as needed.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T04:24:04+00:00Added an answer on May 18, 2026 at 4:24 am

    I assume you are talking about CSS Sprites. Here’s a A List Apart article to get you started: http://www.alistapart.com/articles/sprites. The basic idea is that you have all of your images combined into a single, large image.

    Whereas normally you will have img tags or small elements with background image applied, now you have the single image applied to multiple elements as a background image, and each of them have different background position values to position the correct image into position. An example of this would be jQuery UI’s icons – the single combined image look like this:

    alt text

    Then each of the individual icons share a single class, with a backgroun-image set:

    .ui-icon{width:16px;height:16px;background-image:url(../images/ui-icons_808080_256x240.png);}
    

    As well as individual background-position for each of the different icons:

    .ui-icon-carat-1-n{background-position:0 0;}
    .ui-icon-carat-1-ne{background-position:-16px 0;}
    .ui-icon-carat-1-e{background-position:-32px 0;}
    .ui-icon-carat-1-se{background-position:-48px 0;}
    

    The same can be done for the individual interactive states – change the background-position of the element on :hover, and you get a different color or icon.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What's the best way to create an HTML document using PHP? I find that
I'm looking for the best way to create a custom border around an HTML
What is best way to create a blinking image animation in wp7? Is there
What's the best way to create a model in Ruby on Rails that doesn't
What is the best way to create a custom UIView that I can consume
What is the best way to create instance of CCSprite from downloaded image file?
What is the best way to create an NSButton with a custom background image,
What is the best way to create databases on C# application, I mean by
What is the best way to create multi-language database? To create localized table for
What is the best way to create a unique id column for table records

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.