html - 无法更改 Primefaces p :commandButton font properties

标签 html css jsf primefaces

我的网站上需要一些看起来与其他按钮不同的自定义按钮。 我已经为这些按钮创建了一个 css 类,但它的行为很奇怪。

这是类(class):

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

    width: 100%; 
    height: 25px; 

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

在同一个 css 文件中导入字体:

@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>

我的问题是,如果按钮位于 p:outputpanel 内部,则不会设置与字体相关的属性(font-family、font-size)。所有其他内容都适用于该按钮。

如果我将按钮放在输出面板之外,一切都会按预期进行。

编辑: 使用 !important 作为字体属性并没有帮助。

最佳答案

您可以用 .ui-button.regCommandButton 替换 .regCommandButton 来解决此问题。

这样做时,您用 .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;    
}

关于html - 无法更改 Primefaces p :commandButton font properties,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26300228/

相关文章:

html - 如何将图像与 <nav> 标签的内容对齐在同一行?

java - 使用 <rich :calendar> 的更改事件重新渲染第三个字段

html - CSS - <p> 的高度,填充为 0

javascript - 更改内容在移动设备上的位置

css - 列宽在 p :column primefaces 中固定时出错

java - GNU gettext 和 JSF

html - Font Awesome 和 Unicode

php - 如何在不兼容的地方实现 aside 标签?

html - 跨平台禁用 android 和 IOS 中的放大功能

css - iframe 内的 overflow-y