无法更改Primefaces p:commandButton字体属性

问题描述:

我需要一些自定义按钮,在我的网站上看起来不同于其他人。 我已经为这些按钮创建了一个css类,但它的行为很奇怪。无法更改Primefaces p:commandButton字体属性

这是类:

@font-face { 
font-family: 'pluto_sansthin'; 
src: url(#{resource['fonts/plutosansthin-webfont.eot']}); 
src: url(#{resource['fonts/plutosansthin-webfont.eot?#iefix']}) format('embedded-opentype'), 
    url(#{resource['fonts/plutosansthin-webfont.woff']}) format('woff'), 
    url(#{resource['fonts/plutosansthin-webfont.ttf']}) format('truetype'); 
font-weight: normal; 
font-style: normal; 

}

HTML实现:

<p:outputPanel> 
    <p:commandButton styleClass="regCommandButton" value="Save" action="#{URBean.saveNewUser}" update="regPanel" /> 
</p:outputPanel> 

我的问题是,在相同的CSS文件

.regCommandButton { 
    color: #ffffff; 
    background: #29b6a0; 
    border-color: #23a38f; 

    width: 100%; 
    height: 25px; 

    font-family: 'pluto_sansthin'; 
    font-size:1.4em;  
} 

字体进口字体相关的公关如果按钮位于p:outputpanel的内部,则不会设置operties(font-family,font-size)。所有其他人适用于按钮。

如果我把按钮放在outputpanel之外,一切都按预期进行。

编辑: 对字体属性使用!重要不会帮助eather。

+0

让你的阅读[链接](http://stackoverflow.com/questions/8768317/how-do -i-覆盖-那些类定义的功能于primefaces-CSS/8774997#8774997)? – mrganser 2014-10-10 13:18:11

+0

@mrganser: 是的,我做了,我相应地加载了我的样式表。在任何其他情况下,我可以重写PF风格类。但是在按钮字体的情况下它不起作用。 – bakcsa83 2014-10-10 13:25:42

+2

'字体颜色'应该'颜色' – mrganser 2014-10-10 13:33:13

您可以用.ui-button.regCommandButton解决这个替换.regCommandButton

这样做,你告诉taht每一个元素与.ui-button.regCommandButton将有描述礼节:

.ui-button.regCommandButton { 
    color: #ffffff; 
    background: #29b6a0; 
    border-color: #23a38f; 

    width: 100%; 
    height: 25px; 

    font-family: 'pluto_sansthin'; 
    font-size:1.4em;  
}