创建按钮时,总是应用类ui-corner-all
。我试过以下内容:PrimeFaces:如何覆盖CSS类
<p:commandButton id="like" styleClass="ui-corner-right" />
但它没有工作。在Firebug的,我看到了两个ui-corner-all
和ui-corner-right
:
<div id="form1:like" type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-left ui-corner-right">
更新1:
继从JMelnik提示,我终于成功加入下面的脚本的ui-corner-all
的改变风格ui-corner-right
:
<style type="text/css">
#myForm\:likeButton .ui-corner-all {
border-radius: 6px 0px 0px 6px !important;
}
</style>
并将<p:commandButton>
包装在<h:panelGroup>
的内部,如下所示:
<h:form id="myForm">
<h:panelGroup id="likeButton">
<p:commandButton />
<h:panelGroup>
</h:form>
更新2:
由于BalusC的建议,下面的解决方案应该会更好:
<style type="text/css">
.likeButton .ui-corner-all {
border-radius: 6px 0px 0px 6px !important;
}
</style>
<h:panelGroup styleClass="likeButton">
<p:commandButton />
<h:panelGroup>
最好的问候,
尝试加载你的css文件到最后,例如在''中,并且确保你覆盖了由'ui-button -ui-widget -i u-state-default ui-corner-all ui -button-text-icon-left'INMO在你的情况下,你最好不要尝试从js中操纵css –
Daniel
'\:'在MSIE中不起作用。在您看来,这样的按钮几乎不可能是完全独一无二的。而是使用类名。 – BalusC
相关:http://stackoverflow.com/questions/8768317/how-do-i-re-write-those-class-defined-in-primefaces-css和http://stackoverflow.com/questions/5878692/how -jsf-generated-html-element-id-in-css-selectors – BalusC