java - 如何在显示标签中指定排序图标的位置

标签 java css jsp jquery-ui-sortable displaytag

我已经使用“sortable=true”对 displaytag 中的列进行了排序......但是我想在列的最右侧显示排序图标......我该怎么做? 这里我只提了一个专栏供大家引用...

<display:column  property="issuerName" scope="col" sortable="true" title="${issuerName}"  headerClass="hixTableHeader" class="displayTagtd" /> 

CSS 代码:

th.sortable a {
    background-image: url(../images/common/header/arrow_off.png);
    background-repeat: no-repeat;
    background-position:right;
    text-decoration: none;
    padding-right:25px;
    padding-left: 25px;

}

th.order1 a{
    background-image: url(../images/common/header/arrow_down.png);
    background-position:right;
    background-repeat: no-repeat;
    text-decoration: none;
    padding-right:25px;
    padding-left: 25px;
}

th.order2 a{
    background-image: url(../images/common/header/arrow_up.png);
    background-repeat: no-repeat;
    text-decoration: none;
    background-position:right;
    padding-right:25px;
    padding-left: 25px;
}

最佳答案

试着把它放在 <th> 上而不是 <a> . <a>display:inline元素,因此它不会拉伸(stretch) <th> 的整个尺寸.

th.sortable {
    background-image: url(../images/common/header/arrow_off.png);
    background-repeat: no-repeat;
    background-position:right;
}

th.order1 {
    background-image: url(../images/common/header/arrow_down.png);
    background-position:right;
    background-repeat: no-repeat;
}

th.order2 {
    background-image: url(../images/common/header/arrow_up.png);
    background-repeat: no-repeat;
    background-position:right;
}

或者您可以应用以下内容,这将有 <a>填写<th>这可能更可取,因为您可以单击 <th> 上的任意位置激活排序。

th a {
    display:block;
    width:100%;
    height:100%;
}

更新

确保您也保留当前样式,要保留下划线,您需要确保它仍然针对您的 <a>标签。您可以将其添加到目标所有 <a> <th> 内的标签标签。

th a {
    text-underline:none;
}

关于java - 如何在显示标签中指定排序图标的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15608932/

相关文章:

java - Range 类的这种实现有什么问题

java - Mockito spy 对象,使用 any() 作为参数进行验证

html - 部分绝对位于彼此之上

javascript - 从 Array 设置背景图片 url

javascript - 拖放(交换、删除)JavaScript

java - 如何在露天获取管理员的主节点引用

java - TextureView:在后台执行 TextureView.getBitmap()

java - 如何使用 Jquery 按值而不是按键打印 HashMap

java - 使用 Cookies 将值保存在 Spring MVC 表单字段中

javascript - 显示一个弹出窗口,其中包含 html 表格中每一行的详细信息