创建按钮时,始终应用类ui-corner-all
。我尝试了以下方法:
<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>
致以最诚挚的问候,
答案 0 :(得分:5)
使用标准的CSS覆盖方式。
在您的页面中加入* .css,您可以在其中重新定义ui-corner-all
和ui-corner-right
个类。
.ui-corner-all {
//ovverides to nothing, you can also define any properties you want here
}
.ui-corner-right {
//define properties which would override unwanted behaviour
}
您还可以应用额外的css类来覆盖不需要的属性。