Search code examples
javascriptjquerycssiconstablesorter

jquery tablesorter CSS arrow icons


This is really more of a CSS question than a jQuery question. I'm using the tablesorter jQuery plugin to sort tables dynamically.

Here's what it looks like currently: enter image description here

Here's the CSS code that I'm using:

th.sortable{
    font-weight: bold;
    cursor:pointer;
    background-repeat: no-repeat;
    background-position: center right;
}

th.headerSortUp {
    background-image: url("arrow-up.gif");
}
th.headerSortDown {
    background-image: url("arrow-down.gif")
}

The problem that I have with the current implementation is that the arrow is way over on the right of the header. In the above example, the table is being sorted by level, but it almost looks like it could be by location.

Is there an easy way to move the arrow over to the left, so it's directly to the right of the end of the "level" label?


Solution

  • Place a span tag in your th and style it with:

    th.headerSortUp span {
        background: url("arrow-up.gif") right center no-repeat;
        padding-right: 15px;
    }