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

  • SEARCH
  • Home
  • 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 6617251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:40:54+00:00 2026-05-25T20:40:54+00:00

I have a table that gets sorted. The headers have background images (arrows) to

  • 0

I have a table that gets sorted. The headers have background images (arrows) to show the sorting direction.

The current CSS uses 3 different images like this:

th {
    padding-right: 21px;
}
th.sorting {
    background: #EEEEEC url("table-sort.png") no-repeat center right;
}
th.sorting_asc {
    background: #ECE0EB url("table-sort-asc.png") no-repeat center right;
}
th.sorting_desc {
    background: #ECE0EB url("table-sort-desc.png") no-repeat center right;
}

Working example in the JSfiddle here.

Is there a way to reduce these to one image and use CSS sprites? The problem is that a merged image cannot simply be used as a background to the header cell, because multiple images may become visible at once, like here.

I’d like to avoid using extra elements if possible. IE7 support would be great but I could probably live without it.

Pseudo elements like :after could work, but I can’t find a way to position the icons in the same way. JSfiddle example.

  • 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-25T20:40:55+00:00Added an answer on May 25, 2026 at 8:40 pm

    I figured out a way for pseudo elements to work. Set the table headers as position: relative, then something like this:

    .sorting:before {
        display: block;
        content: "";
        position: absolute;
        top: 50%;
        right: 8px;
        width: 7px;
        height: 9px;
        margin-top:-4px;
        background: transparent url("http://i.imgur.com/iONZm.png") 0 0;
    }
    

    The icon is positioned 50% from the top, then moved upward a few pixels to be vertically centered.

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

Sidebar

Related Questions

I have a 5 million row table that gets hit with a specific query
I have a self referencing table in Oracle 9i, and a view that gets
I have table that gets dynamically created. When using jQuery and toggle, everything works.
I have a table view that gets refreshed two different ways. Both are through
We have a table with a Primary Key that gets populated on insert by
I have the classical table with expandable and collapsible records that if expanded show
I have a SQL Table UDF That gets a Standard Deviation from a 20
I have a table that contains lots of integers. This table gets queried and
I have a log table that gets processed every night. Processing will be done
In Drupal, I have a table node that gets generated from mysql user data.

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.