css - p :dataTable style change?

标签 css primefaces

我正在使用 PrimeFaces dataTable 组件,如下所示:

<p:dataTable 
 value="#{bean.objects}" var="item"
 paginator="true" 
 rows="10"
 paginatorTemplate="{FirstPageLink} 
                    {PreviousPageLink} 
                    {PageLinks} 
                    {NextPageLink} 
                    {LastPageLink} 
                    {RowsPerPageDropdown}"
 rowsPerPageTemplate="5,10,15,20,30,50,100"
 styleClass="shorterDropdown"> 
 <p:column>... 
 </>
</>

paginatorTemplate 添加了 RowsPerPageDropdown。我的目标是通过 css 文件中的 shorterDropdown 类更改此下拉菜单宽度,但它不起作用。这是 CSS 代码:

select.shorterDropdown 
{ 
    width:45px;
}

如何通过 CSS 更改此下拉菜单的宽度?

最佳答案

要覆盖 Primefaces 的默认样式,请编辑您的 CSS 修改(使用开发者工具,找到 css 选择器(类名 ....))然后添加“importante!”像这样的 CSS 规则 style="background: red !important;"


有关css优先级的更多信息:(调用顺序:最后调用的是应用的)在同一级别时:
重要的! > #id > .class > html 标签

希望对您有所帮助。

关于css - p :dataTable style change?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21262414/

相关文章:

java - 如何在登录时显示带有欢迎消息的通知?

jsf-2 - 以编程方式访问 JSF 和 Primefaces 版本号

javascript - 禁用 p :calendar? 中的特定日期

html - 将一个 div 放在父 div 的底部

sorting - Primefaces 数据表排序和过滤在 rowSelect 之前不起作用

asp.net - 在 VB 中更改元素的 CSS 样式

javascript - 在单元格内单击时调用函数

tomcat - Primefaces fileUploadListener 未使用 websphere 8.5 调用

css - 为什么在我的 TextArea 的第一行之前有一些填充?

html - 响应式选择下拉选项在桌面 Chrome 浏览器移动 View 中显示为黑色矩形框