Mr.*_*mes 5 css styling primefaces jsf-2
创建按钮时,ui-corner-all始终应用该类.我尝试了以下方法:
<p:commandButton id="like" styleClass="ui-corner-right" />
Run Code Online (Sandbox Code Playgroud)
但它不起作用.在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">
Run Code Online (Sandbox Code Playgroud)
更新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>
Run Code Online (Sandbox Code Playgroud)
并将<p:commandButton>内部包装<h:panelGroup>如下:
<h:form id="myForm">
<h:panelGroup id="likeButton">
<p:commandButton />
<h:panelGroup>
</h:form>
Run Code Online (Sandbox Code Playgroud)
更新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>
Run Code Online (Sandbox Code Playgroud)
最好的祝福,
使用标准的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
}
Run Code Online (Sandbox Code Playgroud)
您还可以应用额外的css类来覆盖不需要的属性.